How to know which category or term you came from in WordPress

I’ve come across projects where the client wanted to do something base on where you came from. So this example will check to see which category or taxonomy term you came from and show a category or term menu based off where you came from.

First start with the link from a taxonomy page. We add the “?cat= and echo the term_id to the permalink url.

Once we’ve clicked through, we get that id, find the parent term so we can list it’s name.

 

Leave a Reply

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

19 − 15 =