Skip to content

Instantly share code, notes, and snippets.

Created March 15, 2017 06:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save anonymous/e7fe5130c33096697a55e38c8a3bed21 to your computer and use it in GitHub Desktop.
Save anonymous/e7fe5130c33096697a55e38c8a3bed21 to your computer and use it in GitHub Desktop.
if (!is_user_logged_in()) {
if (!in_array($GLOBALS['pagenow'], array('wp-login.php'))) {
if (did_action( 'searchwp_indexer_pre' )) {
//Indexer
} else {
$actual_link = (isset($_SERVER['HTTPS']) ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
if ( wp_redirect(wp_login_url($actual_link)) ) {
exit;
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment