Support » Fixing WordPress » Top admin tool bar not displaying for “Editor” user role

  • Resolved jonsapinsider

    (@jonsapinsider)


    To handle user role permissions – I decided that not all of 50 users should have Administrative roles – Most of our user are “Editors” and so I switched them from an Administrative role to Editor.

    Problem now is that the Editor users don’t have access to the top tool bar. (They had access to it when they are an Administrator role).

    What I tried so far

    I made sure that ” Show Toolbar when viewing site ” has been checked.
    I disabled all of the plugins in a staging env until the site crashed.
    Switched to a new theme (and it worked)
    Any troubleshooting ideas would be most welcome

    Also – Is there any php documentation that pertains to this feature? How would one insure that users have access to the top admin tool bar when developing a theme with php?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Can you search your theme’s functions.php file for the following:

    add_filter( 'show_admin_bar', '__return_false' );

    That’s one way to hide the admin bar programmatically.

    Thread Starter jonsapinsider

    (@jonsapinsider)

    Hi @jessn thanks for replying.

    I tool a look and it seems that there is a function in the functions.php file

    add_action('after_setup_theme', 'remove_admin_bar');
    function remove_admin_bar() {
    if (!current_user_can('administrator') && !is_admin()) {
      show_admin_bar(false);
    }
    }

    Looks like the if statement is declaring that if the current user is not an admin – don’t show the admin bar.

    I’m not sure if this would be the correct code but please do let me know if you see a programmatically error below :

    if (!current_user_can('administrator', 'editor' ) && !is_admin()) && !is_editor()) {
      show_admin_bar(false);
    }
    }
    Thread Starter jonsapinsider

    (@jonsapinsider)

    I switched show_admin_bar(false); to true and looks like everything is working normally.

    Looks like this is resolved.

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.