Wordpress - Don't display sub category posts

To limit the post being displayed on a category or archive page. You just need to add the following code to the top of you archive.php (or category.php) file.

$this_category = get_category(get_query_var('cat'),false);
$category_ID = $this_category->cat_ID;
query_posts( 'category__in='.$category_ID); // limit it to posts only in this category

items on the category should now only display posts that are assigned to the current category and not display any sub category items

You may be interested in...

Had enough browsing?

Get in touch

Get in touch

We wont charge you for the inital project meeting. So really you have nothing to lose.

Fill out the form below with as much information as you can provide and we will be in touch with you asap to discuss.

Please type your full name. Also only allowing alpha numeric characters here. Why do you have all this fancy stuff in your name anyway?

Invalid email address.

Please enter a valid phone number.

Enquiry Type(*)
Invalid Input

Please only use alphanumeric characters in your message

Invalid Input