Excluding Category Not displaying
-
Hi experts,
I have used a function to not to display a particular category from my Blog page and its working correctly .
I am displaying this excluded category in a separate Page which is not working because of this filter $query->is_archive.If i remove it from function then i can see the category page but disabling it causes that particular category display into archive .. Is there is way I can meet both the condition i.e stop that category from displaying in archive page and also displaying the Category is separate page.
Here is the function code
function exclude_category($query) { if ( $query->is_home() ||$query->is_feed()||$query->is_archive ) { $query->set('cat', '-195'); } return $query; } add_filter('pre_get_posts', 'exclude_category');
Thanks in advance.
- The topic ‘Excluding Category Not displaying’ is closed to new replies.