Show different page for first time user

Use template_include with your conditional for first time visitor: add_filter( ‘template_include’, ‘first_time_visitor_template’, 99 ); function first_time_visitor_template( $template ) { if ( // your conditional for first time visitor { $new_template = locate_template( array( ‘first-time-template.php’ ) ); if ( ” != $new_template ) { return $new_template ; } } return $template; } Do NOT use template_redirect … Read more

How to pass a message using template_redirect

You could approach the problem from the other side and look up the post based on the HTTP_REFERER, available in the $_SERVER superglobal: http://php.net/manual/en/reserved.variables.server.php You could perform a lookup of the page based on the URL of $_SERVER[‘HTTP_REFERER’] and get post information that way. You can also keep your 301s cleaner by not adding referrer … Read more