Skip to content

Instantly share code, notes, and snippets.

@brasofilo
Last active December 12, 2018 12:34
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save brasofilo/5992742 to your computer and use it in GitHub Desktop.
Save brasofilo/5992742 to your computer and use it in GitHub Desktop.
Disable wp-admin and wp-login
<?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