Exclude Category using Child Theme
-
I feel like I’m doing everything with best practices and it’s not working.
I created a child theme, so as not to affect the original functions.php.
I know my child theme functions page is being “read” cuz when I have a typo, it gives me an error message.
Here’s my exclude function, copied & pasted directly from the codex page.
*******************************************************************
function exclude_category( $query ) { if ( $query->is_home() && $query->is_main_query() ) { $query->set( 'cat', '-17,-18' ); } } add_action( 'pre_get_posts', 'exclude_category' );*******************************************************************
Yes, I’ve double-checked that the category numbers are correct. Yes, I’ve tried the opposite function, to display just one category, also didn’t work. (i.e. all categories continue to display.)
Why isn’t it excluding those two categories (advertisers, testimonials)?
The page I need help with: [log in to see the link]
The topic ‘Exclude Category using Child Theme’ is closed to new replies.