exclude category from `get_adjacent_post` not working
-
I’m trying to exclude a category (category id = 8) from a custom **prev-next post navigation** I have included in my wordpress site.
As shown here I have added the ‘8’ in the following for but it is not excluding category #8 posts from the navigation.
`// Don’t print empty markup if there’s nowhere to navigate.
$previous = ( is_attachment() ) ? get_post($post->post_parent) : get_adjacent_post(false, ‘8’, true);
$next = get_adjacent_post(false, ‘8’, true);if (!$next && !$previous)
return;$prevPost = get_previous_post(false, ‘8’);
$prevthumbnail = get_the_post_thumbnail($prevPost->ID, ‘thumbnail’);
$nextPost = get_next_post(false, ‘8’);
$nextthumbnail = get_the_post_thumbnail($nextPost->ID, ‘thumbnail’);`Can someone please help me out in pointing out the mistake(s) I made above.
P.S. The thumbnail of posts from category 8 are being removed from the navigation but not the post though.
The site I’m using the above navigation on is https://wyrta.com/
- The topic ‘exclude category from `get_adjacent_post` not working’ is closed to new replies.