Last active
December 12, 2018 12:34
-
-
Save brasofilo/5992742 to your computer and use it in GitHub Desktop.
Disable wp-admin and wp-login
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: Disable Admin and Login | |
Plugin URI: http://wordpress.stackexchange.com/a/106437/12615 | |
Requires: PHP 5.3 | |
*/ | |
add_action( 'init', function() | |
{ | |
$currentURL = $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"]; | |
if( strpos( $currentURL, 'wp-admin' ) or strpos( $currentURL, 'wp-login' ) ) | |
{ | |
wp_redirect( site_url() ); | |
exit; | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment