I have some trubles to get the last modified date and author from a post.

<?php the_modified_author(); ?> <!--/*and*/--> <?php the_modified_date(); ?>

Unfortunateli this two functions dosen't seem to work for me. I was trying to edit a post with the Plugin WP User Frontend and a different user. But some how WP dosen't save it, if it is not the Admin. However the correct revision get saved. So my question is how get author, author-link and date of the newest revision?

Note: Recently I coded a function to get the number revisions - if it is helpful:

function revisions_number( $post_ID = '', $zero = '', $one = '', $more = '' ) {

    $args = array( 'post_parent' => $post_ID, 'post_type' => 'revision', 'post_status' => 'inherit');
    $query = get_children($args);

    $more = str_replace(array('%', ''), count($query), $more);// replacing % with revisions number

    if ( count($query) == 0 ) { // has 0 revisions
    echo $zero; 

    } elseif ( count($query) == 1 ) { // has 1 revision
    echo $one;

    } else { // has at least 2 revisions
    echo $more;


1 Answer 1


To get the_modified_author() we have to look in the folder wp-includes and search for the author-template.php.

Line 101 shows:

 * Display the name of the author who last edited the current post,
 * if the author's ID is available.
 * @since 2.8.0
 * @see get_the_author()
function the_modified_author() {
    echo get_the_modified_author();

You can use: <?php echo get_the_modified_author(); ?>

To get the_modified_date(); we will have to take a look in the same folder (wp-includes) and find the file general-template.php.
Line 2251 shows:

 * Retrieve the date on which the post was last modified.
 * @since 2.1.0
 * @param string $d Optional. PHP date format. Defaults to the    "date_format" option
 * @return string
function get_the_modified_date($d = '') {

    if ( '' == $d )
        $the_time = get_post_modified_time(get_option('date_format'), null, null, true);
        $the_time = get_post_modified_time($d, null, null, true);

     * Filter the date a post was last modified.
     * @since 2.1.0
     * @param string $the_time The formatted date.
     * @param string $d        PHP date format. Defaults to value specified in
     *                         'date_format' option.
    return apply_filters( 'get_the_modified_date', $the_time, $d );

You can use: <?php echo get_the_modified_date(); ?>

Please see for more detail:

To get the url from the author which has modified the post as last I suggest to use a function.
(please make first a backup of functions.php and then add this function)

 * Return the URL of the author (who modified post as last)
 * Codex:   {@link https://developer.wordpress.org/reference/functions/get_post_meta/}
 *          {@link https://codex.wordpress.org/Function_Reference/get_author_posts_url}
 * @version WordPress 4.6   
function wpse_238105_modified_author_posts_url()
    global $post;

    // Get the ID of the author(meta: _edit_last)
    if ( $id = get_post_meta($post->ID, '_edit_last', true ) )
        // return URL
        echo get_author_posts_url( $id );
} // end function

Note: see the @link urls in the function above for references.

You can now use it as following in a template:

Last modified by <a href="<?php wpse_238105_modified_author_posts_url(); ?>"><?php the_modified_author(); ?> </a> on <?php the_modified_date(); ?>

The name of the author who has modified the post as last is now 'clickable'.

  • Yea I see now it's probably something wrong with the plugin. It simply doesn't save the modified author, if you editing with different users. The date is right under the post content at the editing page on WP backend. This is the Plugin: WP User Frontend Pro
    – Game Unity
    Sep 4, 2016 at 12:18
  • FYI, get_the_modified_author() does not take an argument (taking a post ID as argument would have been welcome.) If, in the context of the admin area (e.g.: extra columns), you're looking to get the name of the last user to have modified an article, go look at the definition of the function inside the WordPress source code to copy it and adapt it to your needs. Jun 7, 2018 at 18:04
  • @FabienSnauwaert I'm not quite sure where to look in the source code. I'm trying to do exactly what you describe: have another column on the backend that shows the username of the last author to modify a post and so get_the_modified_author() doesn't work. Where should I be looking in the source code if you could give me a hint? Thanks.
    – poncho
    Aug 1, 2018 at 15:51
  • 1
    @poncho Look into get_the_modifier_author. Copy-paste the code and you can replace get_post()->ID with your own ID of interest. Aug 2, 2018 at 0:38
  • @FabienSnauwaert Ah I see what you mean now, thanks for the reply, I've got it working how I want now, thank you.
    – poncho
    Aug 3, 2018 at 9:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.