next_post_link/previous_post_link only for parent category
-
Hello,
I have my posts organized in categories and subcategories.
In my theme, I have links to previous and next posts on my single page, but it shows these links even if previous and next posts are from a different parent category.How is it possible to limit this function only to my parent category, and all its child categories?
https://codex.www.ads-software.com/Function_Reference/previous_post_link
in_same_cat
(boolean) Indicates whether previous post must be within the same category as the current post. If set to TRUE, only posts from the current category will be displayed. Options are:* TRUE
* FALSE (Default)Its almost what I need, but I don’t see how to use it for a parent category.
If anyone has an idea… Thanks in advance.
- The topic ‘next_post_link/previous_post_link only for parent category’ is closed to new replies.