Archived topic
How can I disconnect certain post category from the post navigation?
8 replies · Started by jisu on October 13, 2022
Hello,
Recently I figured out how to hide the post category from my blog page, but When I write a post, the post navigation shows my hidden category blog post. How can I disconnect the hidden category from the post navigation?
Thanks
Hi there,
see Toms reply here:
Hello,
I have added the code but hidden blog post is still appear in my blog post navigation.
Please check below URLs
https://swim.im/blog/celinebrandstory/
I have another problem.
I only see hidden category post in every issued post's post navigation.
I fixed this problem by editing snippet code, but i still can't exclude hidden blog category from post navigation. I have tried the code that you provide from previous forum but nothing happen. Please take a look at the link i left on reply.
thanks,
So this is the code to remove Posts of a specific Category from the post nav:
add_filter( 'get_next_post_excluded_terms', 'tu_exclude_terms' );
add_filter( 'get_previous_post_excluded_terms', 'tu_exclude_terms' );
function tu_exclude_terms() {
return array( 10, 15 );
}
the 10 and 15 are the Category Term IDs. you need to swap them to the category(ies) you want to exclude.
If thats not working, please share a post to where i can see the problem.
what is the category terms IDs?
https://swim.im/blog/celinebrandstory/
in the end of the post you see hidden post which i want to exclude.
thanks,
David,
I found out the id. Problem resolved. Thanks
Glad to hear that!!