So here is the situation, I have a wordpress blog site that is a few years old, and every user had a different account to post with.

Now what i want is a plugin/script that automatically adds the name of each author as a tag or a category.

So for example if 'Andre' was the author of a blogpost made on my site a few years ago, he should be tagged in that blogpost Tags: Andre, another thing tagged before, etc

The solution needs to work for posts previously made.


  • Any particular reason they need to be Tags? Since the post authors are already stored, you could update your theme instead to show the post author, and there is an option to have an author archive where you can see all the posts written by a particular author. – WebElaine Nov 5 '18 at 20:07
  • 1
    Hi, so I am moving the blog to another theme where those authors do not exist and a requirement is that we do not recreate these accounts, so we decided tagging to be the way that the admin can make the post but tag the actual authors so users can sort by author. – RIcky Arora Nov 5 '18 at 20:10

I would do this by looking into the wp_get_post_revisions

So put this in your functions.php:

function show_revisions( $revisions ){
  echo '<ul>';
  foreach( $revisions as $revision ):

    // Gets the author if there is one.
    // Prints (??) if there isn't one.
    $author = empty( ucfirst( get_the_author_meta( 'display_name', $post_author ) ) ) ? '(??)' : ucfirst( get_the_author_meta( 'display_name', $revision->post_author ) );

      echo '<li>';
      echo '<p>Author:' . $author . '</p>';
      echo '</li>';
  echo '</ul>';

And put this in your single.php and/or page.php and/or whereever you want the list of authors to be shown:

$revisions = wp_get_post_revisions();
show_revisions( $revisions );
  • Is there anyway I could get a full working solution. I know how to code I just don't know where exactly to put these sorts of functions and where to call them etc on wordpress. – RIcky Arora Nov 7 '18 at 15:40
  • @RIckyArora Done. :-) – Zeth Nov 7 '18 at 23:42
  • Hi Zeth, thanks for the help, so my understand is that this function will take in a variable which we will call $revisions then we have a foreach loop and that this whole function will create a list of authors, what i want to do is tag each author in each post made, so can we modify the forloop so it simply tags each author in each post by name? – RIcky Arora Nov 12 '18 at 16:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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