• I am trying to modify wp_query within plugin to also include posts marked “private”:

    if (have_posts()) {
    global $wp_query;
    query_posts(array_merge($wp_query->query, array(‘post_status’ => array(‘published’,’private’),’post_type’ => ‘post’)));

    while (have_posts()) {
    the_post();

    }
    }

    but $wp_query->found_posts shows global $wp_query count not including merged arguments. What am I doing wrong?

    Thanks!

    P.S. I have checked theme’s functions – nothing to modify query_post there…

The topic ‘query_posts not updating $wp_query->found_posts’ is closed to new replies.