
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.

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(); ?>
By the way, I got a few ad spots to sell on WpRecipes. Price is $30 for a month. Contact me if you're interrested!
Credits goes to Valentin Brandt for this awesome recipe!
7 Responses
You should warn your readers that they should expect fatal error after upgrade to 2.8 because of functions duplication. If you can’t wait a few weeks, use function_exists() at least…
@Peter Kahoun: You’re totally right on that point. I’m going to correct it.
Interesting to see what WP 2.8 has to bring to the table.
Thanks for the tip. Very helpful. Keep writing…
Hope WP 2.8 have a lot of new great features.
Trackbacks: