Created
April 20, 2015 01:00
-
-
Save SErr0r/cbc3f7b2acd0fea7296a to your computer and use it in GitHub Desktop.
Запретить пользователям доступ в панель администратора WordPress
This file contains hidden or 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
add_action( 'init', 'blockusers_init' ); | |
function blockusers_init() { | |
if ( is_admin() && ! current_user_can( 'administrator' ) && | |
! ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) { | |
wp_redirect( home_url() ); | |
exit; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment