Support » Plugins » Exclude category from single post navigation (prev/next)

  • I am using the WP-iCal plugin from Garrick Van Buren and I don’t want my calendar category to show up anywhere in the blog. I have managed to exclude it from the loop and from the category listing, but when I view individual posts, the posts from my calendar category show up as previous/next posts. Anyone know how to keep them from showing up there?

Viewing 11 replies - 1 through 11 (of 11 total)
  • previous_post_link and next_post_link have provision for excluding categories, but there is a bug in WP that keeps it from working. The function looks for the excluded category numbers in the posts table rather than post2cat. Hopefully this will be fixed soon.

    Does anyone know what the bug is and how we can fix it instead of waiting for a fix to be released? I had this working in 1.5.2 and now it’s broken in 2.0……..

    I found this patch here:

    However, it doesn’t support mutliple categories like previous WP versions. Does someone have a TRAC account that would like to reopen this ticket?

    That’d be great….

    @ielliot: I reopened the ticket with some clarifying notes. I hope this results in a fix soon. I too saw the patch, but it didn’t work for me.

    Hey… newbie here…

    I just run into this same problem: Posts from an excluded category are still showing up in my previous and next post links in the single.php template.

    The following code is not working for me:
    <?php previous_post(‘%’,’Previous’,’no’,”,”,’1 and 11′); ?>

    I’ve tried it excluding only one category, as integer, as string, with default values for all other variables, without, etc… The categories are not being excluded from the links… even if I assign the post to only one category and only exclude that one.

    Not sure if I’m reading this right, but the bug reported in ticket 2215 appears to be fixed?

    If so, could someone please tell me what I need to do to get the fix?

    (I’m not a developer, so I’m not quite sure of what to do with the attachments on those tickets..)

    thanks in advance…

    Somehow I was able to apply the patch mentioned above, and it seems to be working for me even when I exclude multiple categories.

    The trick -appears to be- is to list the excluded categories in descending order.

    So ‘1 and 11 and 19’ didn’t work
    But ’19 and 11 and 1′ seems to work perfectly.

    Another noob with similar problems. When I click on a Post and it is opened in it’s own, single page, I would like to restrict the navigation links to only go to posts in the SAME Category. After clicking the link posted by ielliot for the fix, I have no idea what that page full of code is or what to do with it… oh..

    Any help fixing this really appreceiated, thanks!

    I don’t think the patch mentioned here is what you need to solve your issue.

    Limiting previous/next navigation to posts in the same category works as expected with the previous_post() and next_post() functions documented here.

    Notice the “in_same_cat” parameter.

    Hi… there is a way to exclude multiple categories in 2.0.2 in single post view? I have patched the file with the changeset 3508 … But it exclude only one category. Also trying in descending order…only the last categories in the order it’s excluded

    Has anyone figure out how to exclude multiple categories with the fix.
    I can only exclude one category.
    wp 2.0.3



    implement the fix and create a parent category then make the categories you want hidden to be its children… 🙂 hope I made sense…

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Exclude category from single post navigation (prev/next)’ is closed to new replies.