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.
Thanks!
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.
Thanks!
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>';
endforeach;
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 );