Last active
July 20, 2022 17:39
-
-
Save tdmrhn/68107a250bdc6ada552f6b80bc5aac84 to your computer and use it in GitHub Desktop.
Exclude Category from Blog Page
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'pre_get_posts', function ( $query ) { | |
if ( $query->is_home() && $query->is_main_query() ) { | |
$query->set( 'cat', '-1, -2, -3' ); | |
} | |
return $query; | |
} ); |
Author
tdmrhn
commented
Jun 28, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment