Co-Authors Plus
[closed] get_coauthors() doesn't work properly outside the loop (3 posts)

  1. michaelsauter
    Posted 2 years ago #

    Using get_coauthors() outside the loop like so get_coauthors($post_id) does not work properly.

    Inside get_coauthors(), the terms for the given $post_id are retrieved. However, if no terms are found, the global $post object is used to retrieve post_author. This leads to problems with posts that were created before co-authors-plus was enabled and haven't been updated since.

    What should happen:
    get_coauthors() should never ask the global $post object about the author when a $post_id is passed. Instead, it needs to get the post of the given $post_id from the database and use that to determine the post author.


  2. aaroneight
    Posted 1 year ago #

    Experiencing this same issue. Did you find a solution?

  3. esmi
    Forum Moderator
    Posted 1 year ago #

    If you require assistance then, as per the Forum Welcome, please post your own topic instead of tagging onto someone else's topic.

    I am now closing this 10 month old topic as it references an older version of WordPress.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Co-Authors Plus
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic