How would I go about adding a column to the Page Admin area that would show the last revision date of all pages? Alongside the Author and Published Date columns?

I need to keep an eye on the page edits that other users do, and right now, the Page Admin area will only show the published date for a published page and the last modified date of a draft. So I need to show the revision date by any user of each published page.

Possibly complicating things is I have post/page revisions disabled in wp-config.php to keep the database down to size, so an action can’t hook into already existing page revision metadata.

But the database contains a post_modified_gmt metadata column, so can that be grabbed by a direct database query? Not a good idea? And would I use this kind of action? http://codex.wordpress.org/Plugin_API/Action_Reference/manage_posts_custom_column

1 Answer
1

Would need some prettifying, but basic code is following:

add_filter('manage_pages_columns', 'add_revised_column');
add_action('manage_pages_custom_column', 'echo_revised_column', 10, 2);

function add_revised_column($columns) {

    $columns['revised'] = 'Revised';

    return $columns;
}


function echo_revised_column($column, $id) {

    if ('revised' == $column)
        echo get_post_field('post_modified', $id);
}

Leave a Reply

Your email address will not be published. Required fields are marked *