I tried it all and since i am not so good in this coding, I want to hide a category and his posts from the homepage I tried all plugins especially wp hide post but it needs pro version and seems Support is not answering on my emails so i rather do not buy that i tried the code that i found everywhere see below,
however my theme has his own categories for products (taxonomy=download_category&post_type=download)
the code i found and tried in many ways to change
function exclude_category($query) {
if ( $query->is_home() ) {
$query->set( 'cat', '-156, -58,-154,-155' );
}
return $query;
}
add_filter( 'pre_get_posts', 'exclude_category' );
so 1 of the things i tried was
function exclude_category_download($query) {
if ( $query->is_home() ) {
$query->set('cat', '-156, -58,-154,-155');
}
return $query;
}
add_filter('pre_get_posts', 'exclude_category_download');
I am completely lost could really use some help
I tried it all and since i am not so good in this coding, I want to hide a category and his posts from the homepage I tried all plugins especially wp hide post but it needs pro version and seems Support is not answering on my emails so i rather do not buy that i tried the code that i found everywhere see below,
however my theme has his own categories for products (taxonomy=download_category&post_type=download)
the code i found and tried in many ways to change
function exclude_category($query) {
if ( $query->is_home() ) {
$query->set( 'cat', '-156, -58,-154,-155' );
}
return $query;
}
add_filter( 'pre_get_posts', 'exclude_category' );
so 1 of the things i tried was
function exclude_category_download($query) {
if ( $query->is_home() ) {
$query->set('cat', '-156, -58,-154,-155');
}
return $query;
}
add_filter('pre_get_posts', 'exclude_category_download');
I am completely lost could really use some help
Have you tried Ultimate Category Excluder plugin? You can use it to exclude categories very easily. You just need to select the categories that you want to remove. It can be very useful, as you are not comfortable with coding.
Also, you can try using the following codes:
function exclude_category_home( $query ) {if ( $query->is_home ) {$query->set( 'cat', '-156, -58,-154,-155' );}return $query;}add_filter( 'pre_get_posts', 'exclude_category_home' );
You can find more information about the method of hiding category here.
@PratikPatel oh my god why i did not think of that, most easy ever thank you so much...
regarding ultimate category excluder i tried them all, not made for that, well only wp hide post showed he could see that other kind of categories, but they not answer
for some one maybe works SIMPLY EXCLUDE, i just found it and it did show up in the special pages that others do not show, however it did not work anymore at least not for me https://wordpress/plugins/simply-exclude
Thank you so much all, saved me some grey hair here! however
i have another website theme etc. from wpjobster, seems i am not able to do that trick... there are some adult categories i would like to exclude