Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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

share|improve this question
add comment

1 Answer

up vote 3 down vote accepted

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);
}
share|improve this answer
    
Works great, thanks. I will look into core WP to see if I can figure out how to add the click to sort column function and change the date format, too. –  songdogtech Apr 1 '11 at 17:17
1  
@songdogtech I remembered scribu had post on custom columns and making them sortable –  Rarst Apr 1 '11 at 17:29
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.