i have a specific post category, eg. id=x which is not shown in category list.

These posts are password protected and should be visible only to those provided with the link.

However current version still allows see posts from all categories using prev/next posts.

What is the easiest way to ommit some of these category id=x from paging?

1 Answer 1


You should be able to exclude the category you don't want to show by adding $excluded_terms to your navigation links. So for example, if the category you don't want showing up is id 4 your link would look like:

<?php next_post_link( '%link', 'Next Post', false, '4' );?>

Same with previous_post_link().

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.