Dynamically change prev next navigation within custom single post page

I have a custom post type with 3 custom taxonomies with it as follows:
Object

Gallery
Community
Category

I have 3 post pages, one for each taxonomy, and filters within it.
So I can see objects filtered by community on one page
And filtered by gallery on a different page

In the single post page, I need these dynamically set options:
1. If prev url is gallery page – then prev next navigation as per the selected gallery
2. Similar navigation fo category and community
3. If filter is set to all, then prev next functions as per post_id

Currently using

<?php previous_post_link(‘%link’, ‘<< Previous Post’, $in_same_term = true, $excluded_terms = ”, $taxonomy = ‘artefact_community’); ?>

To get the job done, so what I assume is needed is a way to set $taxonomy and not have it change once prev and/or next is clicked

I do not want multiple filters on the same page – the 3 page format is part of the requirements, so pls suggest solutions that maintains the same.

Read more here:: Dynamically change prev next navigation within custom single post page

Leave a Reply

Your email address will not be published. Required fields are marked *