admin管理员组

文章数量:1429999

I've created following function to run a stylesheet for the admin area, but I want to runt it only for 'shop_manager' this user role and for others, it should not make any modifications from that stylesheet.

// Update CSS within in Admin
function admin_style() {
    if (current_user_can( 'administrator' ) ) {
        return admin_style();
    }
  wp_enqueue_style('admin-styles', get_stylesheet_directory_uri().'/admin.css');
}
add_action('admin_enqueue_scripts', 'admin_style');

Problem with it is, when I put shop_manager in user role section it loads only shop_manager's admin dashboard and not the Administrator's. And when I add ! current_user_can it happens the same but vice versa. Please help!!

本文标签: admin cssRun function for specific user only