Exclude categories from main page question
-
Hello, I am using the following function to exclude posts(categories) from the main page of my blog.
function my_exclude_category( $query ) { if ( $query->is_home ) { $query->set( 'cat', '-3'); } return $query; } add_filter( 'pre_get_posts', 'my_exclude_category' );
It works great, but I want it to work only if I have selected 1 category(when creating the post) so:
If the post is on Videos category(id = cat3) I want it to be hidden, but if I check both Video category and General when making the post, it should be visible.
Is that possible?
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Exclude categories from main page question’ is closed to new replies.