Temporarily modify urls of primary nav menu programmatically
-
I occasionally need to pass a parameter via my permalinks’ URLs, and when I do so, I capture that parameter in a session variable: $_SESSION[‘myparam’].
Once my $_SESSION variable gets populated, I need my primary navigation menu to temporarily rewrite all the URLs of each menu item in that menu with ?myparam=X at the end of each URL.
However, I DON’T want this to be a permanent change. I only want it to apply to the current session.
For example, a primary menu item that points to: https://www.example.com/page/ needs to temporarily point to: https://www.example.com/page/?myparam=X instead for the duration of the session.
Is there a way to accomplish this without permanently rewriting the URLs of the primary menu items?
- The topic ‘Temporarily modify urls of primary nav menu programmatically’ is closed to new replies.