Home>Support>Previous/Next to point only to posts within a category

Previous/Next to point only to posts within a category

I have followed the instructions in this thread https://siteorigin.com/thread/plese-check-my-approach-to-enablig-previousnext-to-point-only-to-posts-within-a-category/ by adding the vantage_content_nav function into the functions.php file my the child theme. I have then edited the links as follows:

<div class="single-nav-wrapper">
    <?php previous_post_link( '<div class="nav-previous">%link</div>', '<span class="meta-nav">' . _x( '←', 'Previous post link', 'vantage' ) . '</span> %title', true, '', 'category' ); ?>
    <?php next_post_link( '<div class="nav-next">%link</div>', '%title <span class="meta-nav">' . _x( '→', 'Next post link', 'vantage' ) . '</span>', true, '', 'category' ); ?>
</div>

This adds the $in_same_term, $excluded_terms and $taxonomy parameters, but it doesn’t seem to work, links to categories outside the selected one are still displaying on a single post.

This is our free support forum. Replies can take several days. If you need fast email support, please purchase a SiteOrigin Premium license.

Get The Most Out of SiteOrigin with SiteOrigin Premium

Find Out More