get_the_modified_author() WordPress Function

The get_the_modified_author() function in WordPress returns the user who last modified the current post.

get_the_modified_author() #

Retrieves the author who last edited the current post.


Return

(string|void) The author's display name, empty string if unknown.


Top ↑

More Information

Usage:
<?php echo get_the_modified_author(); ?>

Top ↑

Source

File: wp-includes/author-template.php

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 : '' );
	}
}


Top ↑

Changelog

Changelog
VersionDescription
2.8.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by the Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.