Skip to content

Instantly share code, notes, and snippets.

@glueckpress
Created April 12, 2012 07:28
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save glueckpress/2365436 to your computer and use it in GitHub Desktop.
Save glueckpress/2365436 to your computer and use it in GitHub Desktop.
Block ANY access to wp-login.php and redirect to a given URL (here: home_url() ).
<?php
add_action( 'init', 'custom_init_function' );
function custom_init_function() {
global $pagenow;
if( ! is_user_logged_in() && 'wp-login.php' == $pagenow ) {
wp_redirect( home_url() ); // redirect URL
exit();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment