I want to check if a user comes from a specific page to the current page.
e.g
if (user comes from /bingo.php)
{ wp_redirect( /newpage.php );exit; }
else { // do nothing };
thank you :)
I want to check if a user comes from a specific page to the current page.
e.g
if (user comes from /bingo.php)
{ wp_redirect( /newpage.php );exit; }
else { // do nothing };
thank you :)
Without completely answering your question, I'd say you could look into $_SERVER['HTTP_REFERER']
. This contains the previous page your user came from. Please note that this is not always set.
Here is my code for my case:
if (!is_user_logged_in() ) {
$icamefrom = $_SERVER['HTTP_REFERER'];
if ( $icamefrom == 'the_site_you_want_to_check') { wp_redirect( '/signup' ); exit; };
}