Support » Plugin: Co-Authors Plus » get_coauthors() doesn't work properly outside the loop

  • 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.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Experiencing this same issue. Did you find a solution?



    Forum Moderator

    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.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘get_coauthors() doesn't work properly outside the loop’ is closed to new replies.