deny access to url for role
-
Hi,
I need some help with this bit of code … the thing is I am trying to deny access to a role name for a specific part of the admin area.
/* * If user is not a SuperAdmin, when they try to access the below URLs they are redirected back to the dashboard. */ function restrict_admin_with_redirect() { $restrictions = array( 'wp-admin/admin.php?page=wpca-settings' ); foreach ( $restrictions as $restriction ) { if ( ! current_user_can( 'manage_network' ) && $_SERVER['PHP_SELF'] == $restriction ) { wp_redirect( admin_url() ); exit; } } } add_action( 'admin_init', 'restrict_admin_with_redirect' );
I am placing this code to my functions php but I can not get it to work.
Any help would be much appreciated
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘deny access to url for role’ is closed to new replies.