Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Plugin Name: Restrict administration access
Plugin URI:
Description: Restrict administration access
Version: 1.00
Author URI:
add_action( 'admin_init', 'custom_wpadmin_blockusers_init' );
function custom_wpadmin_blockusers_init() {
if ( !current_user_can( 'activate_plugins' ) ) {
wp_redirect( home_url() );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.