I already had this function
add_filter('pre_get_posts', 'excludeCat');
function excludeCat($query) {
if ( $query->is_home ) {
$query->set('cat', '-5');
}
return $query;
};
I put them back => disabled because on this page https://ac9a-86a90d6267d0.wptiger.fr/lm-wedding-planner it removes the related post. I had added the following function also for related posts (which worked very well) :
add_filter( 'get_next_post_excluded_terms', 'tu_exclude_terms' );
add_filter( 'get_previous_post_excluded_terms', 'tu_exclude_terms' );
function tu_exclude_terms() {
if ( has_category( 4 ) ) {
return array( 5 );
} elseif ( has_category( 5 ) ) {
return array( 4 );
}
};
In fact, I wish that on my Blog page there are only the articles of “x” category. When you click on these posts you will find related posts from the same category at the bottom.
On my Achievements page, inside a post in this category there are only related posts from the same category.
The function I set up worked fine but just disabled my dashboard display of the posts