Guest author wp_posts ID mistaken for wp_user ID in get_coauthors()
-
To my knowledge, we have never added Guest Authors, but at some point two were somehow created on my blog with names/slugs/emails identical to existing Users on the blog. Not quite sure how these were generated–at what point are Guest Authors generated?
But the bigger issue is that with these “duplicate” Guest Authors (duplicate in the sense that their post_title is the same as an existing User’s slug), they collide with the actual User within get_coauthors(). Now, when I iterate through the results of get_coauthors(), I get back the ID of the wp_posts Guest Author instead of the ID of the wp_users User. I then go on to display the completely wrong avatar and user information. In our situation, all of a sudden, a random User appears to be the author of the page.
When I go into the Users>Guest Authors and delete these Guest Authors, things return to normal. So I guess this brings up several issues:
- Under what circumstances are guest authors created? I want to better understand how these “dupes” were silently created.
- Can you not create a guest author if a User with this slug already exists? This seems a bad idea regardless of whether you fix collisions downstream.
- When there exists a User and a Guest Author with the same slug/post_title, shouldn’t you defer to the User? I think some changes to the get_coauthors() function are necessary to avoid this collision.
Thanks for the terrific plugin and I hope that this helps you track down the problems I describe.
https://www.ads-software.com/extend/plugins/co-authors-plus/
- The topic ‘Guest author wp_posts ID mistaken for wp_user ID in get_coauthors()’ is closed to new replies.