Hi there,
I would like to hide a category from the latest news on home page.
Is it possible?
Thank you
Hi there
Hope you are having a good day and thank you for your question
There is no option within the theme to exclude a specific category from the theme.
However, you add the following sample code for the same.
function exclude_category_home( $query ) {
if ( $query->is_home ) {
$query->set( 'cat', '-5' ); //where 5 is tge category ID
}
return $query;
}
add_filter( ‘pre_get_posts’, ‘exclude_category_home’ );
Thanks!
Colorlib Support Team
Thank you so much.
Your support is always kind and prompt
Thank you so much
I will close this case now, Feel free to contact us again if you have other questions
Thanks!