• This may be a bug in the updated plugin, or maybe it’s intentional, I don’t know.

    I have written my own WP_Query to get posts by authors (both WP users and co-authors). I followed the example here: https://vip.wordpress.com/documentation/list-posts-by-a-co-author/

    This works fine on version 3.2.2, but as soon as I upgrade to 3.3.0 it stops working for guest authors. I’ve had a look at the query it generates and it’s writing the query to include a check for post_author=$id, and for my guest authors that $id var is showing as 0 (which is clearly incorrect), therefore no posts show.

    It still pulls posts for the guest author when in the loop, but I want to do this outside of the loop. Anyone else seen this issue? Is there another way I can pull out posts by guest authors outside of the loop?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hey, same thing here… I am trying to query post authors/co-authors by using that code with no success. Please, let me know if you find any solutions, I am trying to do the same here… Thank you.

    Thread Starter tinytim84

    (@tinytim84)

    My workaround at the moment (and it’s not really ideal) is that I’m using to loop to go through all posts and then storing the post ID in an array by using get_the_ID(). I then pass that off to my function that does the query and then use the post__in argument to get those posts. I also have to add this to the functions.php file

    if ( $query->is_author && !is_admin() ) {
      set_query_var('posts_per_page', -1);
    }
    add_filter('pre_get_posts', 'change_wp_query_size', 999);

    That just ensures that I pull all posts from that author in the loop as the default is 10.

    Not ideal, but it’s working right now. Hoping that they will fix this in a future release.

    • This reply was modified 6 years, 5 months ago by tinytim84.

    My workaround now is querying all items of the specific custom post type I use (the way you did) in my website and doing:

    $edit_url = get_edit_post_link( $post_id );

    and then I test if that variable is valid:

    if( $edit_url ) {
      // do somthing here
    }

    When user is author/co-author of the post, that variable ($edit_url) carries a valid edit URL. Otherwise, it is empty or false.

    • This reply was modified 6 years, 5 months ago by mabho.

    Hi there,
    I have tested this out with the latest version take from GitHub, and I can’t reproduce the issue. If the issue is still there even with the latest version of the master branch, then open up an Issue on GitHub with steps to reproduce ??

    Have a nice day,
    Stefano

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Get posts by guest author no longer working after 3.3.0 update’ is closed to new replies.