WordPress Posts Last Modified Admin Column

Glenn Blog 0 Comments

This WordPress snippet adds an additional ‘Last Modified’ column to your WordPress Posts’ Admin Columns and shows the date and time the post was last modified and also the user that performed the last edit.


// see when wordpress posts last modified
add_action ( 'manage_posts_custom_column', 'rkv_post_columns_data', 10, 2 );
add_filter ( 'manage_edit-post_columns', 'rkv_post_columns_display' );

function rkv_post_columns_data( $column, $post_id ) {
 switch ( $column ) {
 case 'modified':
 $m_orig = get_post_field( 'post_modified', $post_id, 'raw' );
 $m_stamp = strtotime( $m_orig );
 $modified = date('j/n/y @ g:i a', $m_stamp );
 $modr_id = get_post_meta( $post_id, '_edit_last', true );
 $auth_id = get_post_field( 'post_author', $post_id, 'raw' );
 $user_id = !empty( $modr_id ) ? $modr_id : $auth_id;
 $user_info = get_userdata( $user_id );

 echo '<p class="mod-date">';
 echo '<em>'.$modified.'</em><br />';
 echo 'by <strong>'.$user_info->display_name.'<strong>';
 echo '</p>';
 break;
 // end all case breaks
 }
}
function rkv_post_columns_display( $columns ) {
 $columns['modified'] = 'Last Modified';
 return $columns;
}

Possible uses could be to:-

  1. Know your post content refresh rate. High quality meaningful and regular post content is great for SEO
  2. Keep tabs on your Web Content or SEO Provider
  3. Improve WordPress Post / File versioning – who performed the last update and when

 

About the Author
wordpress posts last modified admin column WordPress Posts Last Modified Admin Column 0da77002febbfe28d15144a57bbcc2c9 s 180 d mm r g

Glenn

A highly experienced WordPress Web Developer, Front-end and Back-end Developer & New Media Specialist with extensive knowledge of a wide spectrum of technologies in the Development and Creative Industries built up over a number of years.

Leave a Reply

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