Posted By

WebPersonality on 01/15/11


Tagged

wordpress


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

anhonestboy


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


 / Published in: PHP
 

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

  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. }

Report this snippet  

You need to login to post a comment.