• Resolved smunk

    (@smunk)


    Hi, I am trying to modify a WordPress query to return posts where a given user is among the authors.

    I would expect it to work with:

    $args = array(
    'author__in' => $authors,
    );

    That works fine for posts with only one author, but if multiple authors is assigned to a post, it only returns those where the author is mentioned first (in the list of multiple authors of the post).

    Please advice how to modify the query to get all posts where a given author is assigned.

    Thank you.

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter smunk

    (@smunk)

    Sort of solved it myself. If using author_name instead, things work as expected:

    $args = array(  'author_name'     => $authorname,  );

    Not sure if it is because author_in demands that all authors of the post are represented in the array, or if it just some curiosity, maybe reading the doc for the WordPress query could shed some light on that… ??

    Plugin Support Riza Maulana Ardiyanto

    (@rizaardiyanto)

    Thanks for sharing the solution that work for your issue @smunk

    It might be useful for other people that facing the same issue.

    We appreciate you using our plugin!

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.