Using WordPress ‘get_the_modified_author()’ PHP function

The get_the_modified_author() WordPress PHP function retrieves the author who last edited the current post.

Usage

$modified_author = get_the_modified_author();
echo 'Last modified by: ' . $modified_author;

Parameters

  • None

More information

See WordPress Developer Resources: get_the_modified_author()

Examples

Display the Last Modified Author on a Single Post

Display the name of the author who last edited the current post on a single post template.

// In single.php, within the loop
$modified_author = get_the_modified_author();
echo '<strong>Last modified by:</strong> ' . $modified_author;

Display the Last Modified Author on a Post Archive

Display the name of the author who last edited the current post on an archive template.

// In archive.php, within the loop
$modified_author = get_the_modified_author();
echo '<strong>Last modified by:</strong> ' . $modified_author;

Display the Last Modified Author with a Custom Prefix

Display the name of the author who last edited the current post with a custom prefix.

// Within the loop
$modified_author = get_the_modified_author();
echo 'Edited by: ' . $modified_author;

Display the Last Modified Author on a Custom Post Type

Display the name of the author who last edited the current post on a custom post type template.

// In single-custom_post_type.php, within the loop
$modified_author = get_the_modified_author();
echo '<strong>Last modified by:</strong> ' . $modified_author;

Display the Last Modified Author in a Widget

Display the name of the author who last edited the current post in a sidebar widget.

// In a custom widget's output
global $post;
$modified_author = get_the_modified_author();
echo '<strong>Last modified by:</strong> ' . $modified_author;