get_the_modified_author()
Retrieve the author who last edited the current post.
Uses: get_post_meta()
Used By: the_modified_author()
1 time — 0.000051 sec (very fast) | 50000 times — 1.22 sec (fast) | PHP 7.0.8, WP 4.6
Hooks from the function
Return
String|null
. The author's display name, empty string if unknown.
Usage
get_the_modified_author();
Examples
#1 Display the name of the author who edited the post last
This code is supposed to be used on pages like is_singular().
<?php echo get_the_modified_author(); ?>
Changelog
Since 2.8.0 | Introduced. |
get_the_modified_author() get the modified author code WP 6.1.1
function get_the_modified_author() { $last_id = get_post_meta( get_post()->ID, '_edit_last', true ); if ( $last_id ) { $last_user = get_userdata( $last_id ); /** * Filters the display name of the author who last edited the current post. * * @since 2.8.0 * * @param string $display_name The author's display name, empty string if unknown. */ return apply_filters( 'the_modified_author', $last_user ? $last_user->display_name : '' ); } }