Exporting page details from WordPress for a content review
Now that we’ve got a large chunk of the UNC Library site‘s content in WordPress, we’re working on setting up a system to do semi-annual content reviews. Before we can plan the review itself, we needed to be able to pull details about our pages from the CMS. WordPress doesn’t have a simple way to export page metadata that would be useful for this task, like the last modified date and the name of who last modified it. As with anything in WordPress, there are of course plugins that would do this for us. But I’m trying to keep our plugin count as low as possible. And a plugin seems like overkill for this kind of thing anyway.
I used the opportunity to expand my WordPress coding chops a tiny bit, and dug into their codebase. A very helpful StackOverflow thread set me on the right path, and wpquerygenerator.com made writing the actual query dead simple.
Here’s my code, also embedded below. Put it in a .php file in your root WordPress directory, then open it in your browser. You’ll get a tab-delimited file suitable for importing into Excel. It includes the title, url, last modified date, and last modified author for your site’s last 50 edited pages. If you want other fields, the code is pretty easy to play with.
From there we’ve got a nice list to start reviewing!