Created
September 19, 2018 14:46
-
-
Save geoclaps/45453308140888ef98bf2e3dacaa29d0 to your computer and use it in GitHub Desktop.
Disable access to Wordpress WP-admin
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
function blockusers_init() { | |
if ( is_admin() && ! current_user_can( ‘administrator’ ) && ! ( defined( ‘DOING_AJAX’ ) && DOING_AJAX ) ) { | |
wp_redirect( home_url() ); | |
exit; | |
} | |
} | |
add_action( ‘init’, ‘blockusers_init’ ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment