Display the latest author who modified a post

April 22, 2009 · Print This Article

WordPress 2.8 will feature a new template tag, the_modified_author(), which allows you to display the latest author who modified the post. Here is how to recreate this function in WordPress 2.7.

To create the function, just paste the code below in your 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 saved the file, you can display the name of the latest author who modified the post by using this code:

<?php the_modified_author(); ?>


Your choice for site templates and wordpress themes

Comments

Got something to say?

You must be logged in to post a comment.