How TO Display Latest Author Who Has Modified The Post In WordPress Blog

Posted by

Hi,

WordPress 2.8+ has new feature of the_modified_author() which allows you to display the latest who has modified the post. In order to display the modified post author you can use this hack and add this code in functions.php file:

if (!function_exists(‘get_the_modified_author’)) {
function get_the_modified_author() {
global $post;
if ( $last_id = get_post_meta($post->ID, ‘_edit_last’, true) ) {
$last_user = get_userdata($last_id);
return apply_filters(‘the_modified_author’, $last_user->display_name);
}
}
}

if (!function_exists(‘the_modified_author’)) {
function the_modified_author() {
echo get_the_modified_author();
}
}

Once you have updated the functions.php file, you can use this code to display the last modified post author details:

<?php the_modified_author(); ?>

That’s it!

Thanks,

Shane G.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.