0

On the admin edit.php page, when i filter the posts by a particular category (using the built in dropdown) it shows all the posts related to that category, and all the posts that are 'under' its child categories.

How can i change this functionality, so when i filter by a category it only shows posts from that category only, no child categories posts.

Will appreciate any help, as i couldnt find any info about this online.

thank you.

0

Display posts that have this category (not children of that category), using category id:

$cat_post = new WP_Query( 'category__in=4' ); // you will replace the 4 with your category ID
if( $cat_post->have_posts()){
  while( $cat_post->have_posts()):
    $cat_post->the_post();

    // NOW RIGHT THE CODE AS PER YOUR DESIGN

  endwhile;
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.