Home » Wordpress » How to restrict user other than administrator to acess wp-admin in wordpress

Here is code restrict user other than administrator to acess wp-admin in wordpress.
Put below code into your theme/funtion.php file

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);

Wordpress Freelancer, Joomla Freelancer Web designer Mumbai india, Wordpress web developer India, Joomla Web developer india, Outsourcing web project india mumbai

By Santosh Kori Published: October 10, 2012 Professional Freelance Website developer 5 stars based on 65 reviews Total time: 24 hour 00 min Wordpress Joomla XHTML CSS jQuery HTML5 eCommerce CSS3 ☞ Offers low cost freelance web designing, asp php asp.net web development services from Mumbai India. Freelance web designer & developer Mumbai India.

I AM NOT AVAILABLE FOR WEB DESIGN & DEVELOPMENT PROJECTS