Skip to:
Content
Pages
Categories
Search
Top
Bottom

Reply To: [Resolved] Need to disable the user access to wordpress admin panel

@henrywright

Moderator

Try using Theme My Login – you can have registration, login, lost password and reset password all within your themed pages.

Disabling access to WP Admin will require some custom code. Put this in your theme’s functions.php file:

// disable access to wp-admin for non-administrators
function block_wp_admin_access() {
    if ( is_admin() && ! current_user_can( 'administrator' ) && ! ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) {
        wp_redirect( home_url() );
        exit;
    }
}
add_action( 'init', 'block_wp_admin_access' );
Skip to toolbar