exclude specific post category from loop – the pagination issue?
-
Hi experts,
I just removed one category(lets say category B with a category id 123) from the homepage post loop using the following code in the function.php
function exclude_category($query) { if ( $query->is_home() ) { $query->set('cat', '-123'); } return $query; } add_filter('pre_get_posts', 'exclude_category');I also have made a page to display this specific category.
The problem is that, when i click any post from this category, in the pagination where shows previous and next post…it will also show the link of article from other categories.
This is also the same for the homepage loop which in the pagination (previous post, next post) will display link for the categoryB post.
Can anyone help to make the pagination(previous and next post link) display correctly?
I don’t have any knowledge of PHP..
Thank you.
The topic ‘exclude specific post category from loop – the pagination issue?’ is closed to new replies.