Here is code restrict user other than administrator to acess wp-admin in wordpress.
Put below code into your theme/funtion.php file
1 2 3 4 5 6 7 8 9 | function block_wp_admin_init() { if ( strpos ( strtolower ( $_SERVER [ 'REQUEST_URI' ]), '/wp-admin/' ) !== false) { if ( !is_site_admin() ) { wp_redirect( get_option( 'siteurl' ), 302 ); } } } add_action( 'init' , 'block_wp_admin_init' ,0); |