Ready to get started?Download WordPress


WP Document Revisions
Query category with only documents yields no results (3 posts)

  1. WorldWideWebb
    Posted 1 year ago #

    I'm using WP_Query to display a list of documents and posts in the current category on one of my page templates, and what seems to be happening (hopefully I'm missing something simple), is that categories which have only documents (zero posts) show no results in the listing. As soon as I add one post to that category, all of the documents in that category are displayed properly. Here's the query:

    $page_categories = get_the_category();
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    $wp_query = new WP_Query( array(
    	'post_type' => array( 'post', 'document' ),
    	'posts_per_page' => 10,
    	'post_status' => array ( 'publish' ),
    	'post__not_in'  => get_option( 'sticky_posts' ),
    	'paged' => $paged,
    	'category__in' => array( $page_categories[0]->cat_ID )


  2. davidfemia
    Posted 1 year ago #

    This ever get resolved for you? This would be a major barrier for my decision to invest time in deploying.

  3. WorldWideWebb
    Posted 1 year ago #

    Nope. All I hear is the chirping of crickets here.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic