Skip to content

Instantly share code, notes, and snippets.

@jchristopher
Forked from anonymous/functions.php
Last active March 15, 2017 19:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jchristopher/1b2104c38af3bb4b94fffe2f7dd76fdb to your computer and use it in GitHub Desktop.
Save jchristopher/1b2104c38af3bb4b94fffe2f7dd76fdb to your computer and use it in GitHub Desktop.
<?php
if (!is_user_logged_in()) {
if (!in_array($GLOBALS['pagenow'], array('wp-login.php'))) {
if ( isset( $_REQUEST['swpnonce'] ) || isset( $_REQUEST['swppurge'] ) ) {
//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