Removing a category from displaying on main blog page
-
Hello, I’ve been trying to remove the podcast category (ID – 209) from displaying on my main blog or articles feed. I’ve tried using the below code but it won’t work, I keep getting an error saying the theme developer won’t let me do it.
function themeprefix_exclude_category( $query ) {
if ( $query->is_home() ) {
$query->set( ‘cat’, ‘-338’ );//add your category number
}
return $query;
}
add_action( ‘pre_get_posts’, ‘themeprefix_exclude_category’ );Is there a plugin to do this?
I have a podcast page and I am using the posts widget to query the podcast category on that page here https://www.sophiaduchess.com/podcast so I want to omit it from my main blog page here – https://www.sophiaduchess.com/articles
The page I need help with: [log in to see the link]
- The topic ‘Removing a category from displaying on main blog page’ is closed to new replies.