Is there a way to change the returned url from word press while still rendering the contents of the requested page?
Say I request /dogs/ but need to append a random string to the end of the url while still rendering the page /dogs/
Where /dogs/foobar/ still renders the /dogs/ page
Currently i am using the method as follows
add_action( 'wp', 'url_change' );
function url_change() {
list($uri, $qs) = explode('?', $_SERVER['REQUEST_URI']);
global $wp;
if(strpos($uri , "dogs") == false) {
}
else{
wp_redirect( $uri . "/foobar/" ,302,'WordPress' );
}
}
Which displays the correct url, but since its a redirect, it tries to find the page listed at this url. Is there a way to just render the /dogs/ page even with the changed url?