WordPress.org

Support

Support » Plugins and Hacks » Hacks » Code to check user role and load custom CSS for dashboard

Code to check user role and load custom CSS for dashboard

  • I’m looking for a piece of code to place in functions.php to load a custom .css file if the user has editor role. Can someone point me in the right direction please.

    (I’m not looking for a plugin).

Viewing 1 replies (of 1 total)
  • Worked it out:

    add_action('admin_head','load_editor_style');
    load_editor_style()
    {
    $templateuri = get_template_directory_uri();
     if(current_user_can('editor')){
     wp_enqueue_style('editorstyle', $templateuri.'/css/editorstyle.css');
      }
    }
    ?>
Viewing 1 replies (of 1 total)
  • The topic ‘Code to check user role and load custom CSS for dashboard’ is closed to new replies.
Skip to toolbar