Skip to content

Instantly share code, notes, and snippets.

@dz0ny
Created April 9, 2014 11:41
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 dz0ny/10258888 to your computer and use it in GitHub Desktop.
Save dz0ny/10258888 to your computer and use it in GitHub Desktop.
put in wp-content/mu-plugins/enforce.php
<?php
function loggedInMust()
{
if ( !is_user_logged_in() ) {
if (wp_login_url() != 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']) {
wp_redirect( wp_login_url() );
exit;
}
}
}
add_action( 'init', 'loggedINMust' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment