<?php
//This outputs a tab-delimited list of the 50 last modified pages, suitable for importing into a spreadsheet.
//By Chad Haefele (chad.haefele@gmail.com), December 2013
//Inspired by the top answer here: http://stackoverflow.com/questions/3464701/export-list-of-pretty-permalinks-and-post-title
//Query built with http://wpquerygenerator.com/
include "wp-load.php";
//Add column headers:
echo "\nPage Title\tURL\tLast Modified Date\tLast Author";
//Build the query and get the results:
$custom_query = new WP_Query(array(
'post_type' => 'page',
'orderby' => 'modified',
'posts_per_page' => 50,
'paged' => (get_query_var('paged')) ? get_query_var('paged') : 1
));
//Loop through the results and display them, tab-delimited:
if ( $custom_query->have_posts() ) {
while ( $custom_query->have_posts() ) {
$custom_query->the_post();
//Extract necessary fields:
$mod_date = get_the_modified_date();
$title = get_the_title();
$url = get_page_link();
$mod_author = get_the_modified_author();
echo "\n{$title}\t{$url}\t{$mod_date}\t{$mod_author}";
}
} else {
echo "Error: No pages met your query's criteria.";
}
?>