Created
April 12, 2024 14:47
-
-
Save amberhinds/8e136e0f835bd8859035735628c1727d to your computer and use it in GitHub Desktop.
Remove posts in category from blog archive
This file contains hidden or 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
/** Remove shorts category from the blog **/ | |
add_filter( 'pre_get_posts', 'amber_exclude_shorts_category' ); | |
function amber_exclude_shorts_category ( $query ) { | |
if ( $query->is_home && ! is_admin() ) { | |
$query->set( 'cat', '-272' ); | |
} | |
return $query; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment