rewrite url with arguments
-
Hi
When someone enters the site with a query string (for example /?utm_source=google), I need to make some changes like change the phone and forms.
I managed to do that somehow, but now I also need the query string to pass along to all pages the user navigates to. So if the user clicks the menu and moves on to another page I need to add the query string to the url so it will look like m/some-page?utm_source=google
I started by at least trying to rewrite the url with some fixed query string but it doesn’t work.This is the code I added to functions.php:
function custom_rewrite_basic() { add_rewrite_rule('.*', add_query_arg( 'key', 'myValue' ,$_SERVER['REQUEST_URI'])); } add_action('init', 'custom_rewrite_basic');- This topic was modified 7 years, 5 months ago by .
- This topic was modified 7 years, 5 months ago by .
The page I need help with: [log in to see the link]
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
The topic ‘rewrite url with arguments’ is closed to new replies.