Title: Query for co-author
Last modified: August 19, 2021

---

# Query for co-author

 *  Resolved [acarvalheiro](https://wordpress.org/support/users/acarvalheiro/)
 * (@acarvalheiro)
 * [4 years, 10 months ago](https://wordpress.org/support/topic/query-for-co-author/)
 * So I’m trying to create a feature similar to Instagram’s posts you’ve been identified
   in where I display all the posts where a user has been assigned as co-author,
   but I can’t seem to get around what args to use in a WP_Query. Besides, is there
   an easy way for me to remove the co-author from the post in the front end?
    -  This topic was modified 4 years, 10 months ago by [acarvalheiro](https://wordpress.org/support/users/acarvalheiro/).
    -  This topic was modified 4 years, 10 months ago by [acarvalheiro](https://wordpress.org/support/users/acarvalheiro/).

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Author [andergmartins](https://wordpress.org/support/users/andergmartins/)
 * (@andergmartins)
 * [4 years, 10 months ago](https://wordpress.org/support/topic/query-for-co-author/#post-14789559)
 * Hi [@acarvalheiro](https://wordpress.org/support/users/acarvalheiro/), thanks
   for getting in touch.
 * All the authors in our plugin are stored as taxonomy terms of “author” taxonomy.
   
   More details here: [https://publishpress.com/knowledge-base/authors-data-backup/](https://publishpress.com/knowledge-base/authors-data-backup/)
 * So basically you need to use the meta query for filtering according to your requirements:
 * [https://developer.wordpress.org/reference/classes/wp_query/#custom-field-post-meta-parameters](https://developer.wordpress.org/reference/classes/wp_query/#custom-field-post-meta-parameters)
 * For easily removing an author of a post, there is no UI in the frontend yet. 
   But you could use the method “MultipleAuthors\Classes\Utils::set_post_authors”.
   The method signature is:
 *     ```
       /**
        * Set the authors for a post
        *
        * @param int $postId ID for the post to modify.
        * @param array $authors Bylines to set on the post.
        * @param bool $syncPostAuthor
        * @param int $fallbackUserId User ID for using as the author in case no author or if only guests are selected
        */
       public static function set_post_authors($postId, $authors, $syncPostAuthor = true, $fallbackUserId = null);
       ```
   
 * I hope that helps. Feel free to email us at [help@publishpress.com](https://wordpress.org/support/topic/query-for-co-author/help@publishpress.com?output_format=md)
   if you have more questions.
 *  Thread Starter [acarvalheiro](https://wordpress.org/support/users/acarvalheiro/)
 * (@acarvalheiro)
 * [4 years, 10 months ago](https://wordpress.org/support/topic/query-for-co-author/#post-14795214)
 * So I’ve been trying to create a very simple (probably not the best) function 
   that removes the current user from a co-authors list, but I can’t seem to get
   it to work and I don’t understand why. Both the get_by_user_id and set_post_authors
   function end up in an error, why is that the case?
 * `function removeID(){
    $id = isset($_GET[‘ID’]) ? $_GET[‘ID’] : ”; $coauthors
   = get_multiple_authors($id); $current = get_by_user_id(get_current_user_id());
   $key = array_search($current_user,$coauthors); unset($coauthors[$key]); set_post_authors(
   $id,$coauthors); }
 *  Thread Starter [acarvalheiro](https://wordpress.org/support/users/acarvalheiro/)
 * (@acarvalheiro)
 * [4 years, 10 months ago](https://wordpress.org/support/topic/query-for-co-author/#post-14795351)
 * after some debugging wordpress says that the two functions mentioned above are
   undefined and I cant see why, are they private in any way? How do I call them?

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Query for co-author’ is closed to new replies.

 * ![](https://ps.w.org/publishpress-authors/assets/icon-256x256.png?rev=3391318)
 * [Co-Authors, Multiple Authors and Guest Authors in an Author Box with PublishPress Authors](https://wordpress.org/plugins/publishpress-authors/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/publishpress-authors/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/publishpress-authors/)
 * [Active Topics](https://wordpress.org/support/plugin/publishpress-authors/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/publishpress-authors/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/publishpress-authors/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [acarvalheiro](https://wordpress.org/support/users/acarvalheiro/)
 * Last activity: [4 years, 10 months ago](https://wordpress.org/support/topic/query-for-co-author/#post-14795351)
 * Status: resolved