Advertisement
arie_cristianD

add last edited by on post meta

Mar 13th, 2025
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.52 KB | None | 0 0
  1. add_action(
  2.     'jnews_render_after_meta_left',
  3.     function () {
  4.         $revisions = wp_get_post_revisions( get_the_ID() );
  5.  
  6.         if ( ! empty( $revisions ) ) {
  7.             $last_revision = array_shift( $revisions );
  8.             $last_editor   = get_userdata( $last_revision->post_author );
  9.             $author_link   = get_author_posts_url( $last_editor->ID );
  10.             if ( $last_editor ) {
  11.                 echo '<span class="last-edited"> - Last edited by: <a href="' . esc_html( $author_link ) . '">' . esc_html( $last_editor->display_name ) . '</a></span>';
  12.             }
  13.         }
  14.     }
  15. );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement