• Hello!

    I’d like to make my previous and Next links in each post only link to previous and next links within the post’s SAME category.

    So for example, my post about cats in the PETS category will only link to the previous PETS and next PETS posts, rather than the next post in chronological order?

    Am I making sense? Can anyone help?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Try searching the WordPress Codex before asking or use a search engine with “WordPress” and whatever you want to do, because it’s going to be faster.

    What you want is at: http://codex.wordpress.org/Template_Tags/next_post_link

    <?php next_post_link(‘format’, ‘link’, in_same_cat, ‘excluded_categories’); ?>

    So in your case in_same_cat will be TRUE… something like:
    <?php next_post_link('%link', 'Next', TRUE); ?>

    Thread Starter meriadoctookme

    (@meriadoctookme)

    Thank you so much! I do appreciate the help.

    Thread Starter meriadoctookme

    (@meriadoctookme)

    Actually, now that I’ve tried this out, it doesn’t work. Is the code perhaps for an older version of wordpress?

    Thread Starter meriadoctookme

    (@meriadoctookme)

    ok, nvm! I figured it out! thank you! Much appreciated.

    LOL, did a google search with this string: “wordpress next post link same category” and got to this forum post before getting to the actual page in the codex.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Previous/next links from the same category as post?’ is closed to new replies.