Wordpress Prevent access to wp-admin – wpsnipp.com Wordpress code snippets for your blog


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. if ( is_user_logged_in() && is_admin() ) {
  2. global $current_user;
  3. get_currentuserinfo();
  4. $user_info = get_userdata($current_user->ID);
  5. if ( $user_info->wp_user_level == 0 )
  6. {
  7. header( 'Location: '.get_bloginfo('home').'/wp-login.php?redirect='.get_bloginfo('home').'/wp-admin/' );
  8. }
  9. }

URL: http://wpsnipp.com/index.php/admin/prevent-access-to-wpadmin/

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.