1

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 :)

Marc Ster
  • 2,276
  • 6
  • 33
  • 63

2 Answers2

2

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.

Bert Peters
  • 1,505
  • 13
  • 30
0

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; }; 
}
Marc Ster
  • 2,276
  • 6
  • 33
  • 63