Skip to content

Instantly share code, notes, and snippets.

@SErr0r
Created April 20, 2015 01:00
Show Gist options
  • Save SErr0r/cbc3f7b2acd0fea7296a to your computer and use it in GitHub Desktop.
Save SErr0r/cbc3f7b2acd0fea7296a to your computer and use it in GitHub Desktop.
Запретить пользователям доступ в панель администратора WordPress
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