Forums

Possible to filter previous/next on multiple categories? (4 posts)

  1. captainsupern00b
    Member
    Posted 2 years ago #

    Quick question: Is it possible to filter the previous/next navigation links for a post by multiple categories instead of just one? It looks like you can filter by one category using the in_same_cat parameter in the next_post_link() arguments list, but I'm uncertain how to do it by more... is there a way?

  2. bobafettig88
    Member
    Posted 2 years ago #

    Bump! I'm encountering this exact same problem. The docs mention...

    <?php previous_post_link('format', 'link', in_same_cat,'excluded_categories'); ?>

    ...but "in_same_cat" just seems to grab the first category related to the post. Is there a way for this to work off of a combination of categories, not just one?

  3. bobafettig88
    Member
    Posted 2 years ago #

    Ha ha haaaa, wow, I am officially hating on the code base for WordPress now. =\ Why does WordPress allow you to associate multiple categories to a post when functions like previous_post_link() don't even consider all of them, only the first category related to the post? Am I missing something here? That's not intuitive at all!

  4. jesseisrad
    Member
    Posted 1 year ago #

    Same boat. I tried Excluding all the other categories associated with that post by ID and that just doesn't seem to work at all.

    Ah, it IS a bug and a workable solution is here!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.