Exclude category on homepage
-
When I exclude a category from showing on the homepage with a plugin or with the function below, the pages with these categories are also removed from the xml sitemap.
Is there a way around this behaviour, so that the pages are still listed on the sitemap?
//* Exclude a Category from WordPress Homepage
function exclude_category_home( $query ) {
if ( $query->is_home ) {
$query->set( ‘cat’, ‘-627 -306’ );
}
return $query;
}add_filter( ‘pre_get_posts’, ‘exclude_category_home’ );
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Exclude category on homepage’ is closed to new replies.