• Resolved filipm123

    (@filipm123)


    When user login they can see on the top of the page a bar with the WordPress icon on the left and on the right the name. can I somehow remove this bar and make it only visible when an admin is logging in?

    Best regards,
    Filip

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi @filipm123,

    To do so, you can copy and paste this code snippet(see below:) in your active theme’s functions.php file at the end of it. This will do the trick. Here is the code:

    // For removing admin bar for subscriber
    add_action( 'after_setup_theme', 'remove_admin_bar' );
    function remove_admin_bar() {
        $user = wp_get_current_user();
        if ( in_array( 'subscriber', (array) $user->roles ) ) {
            show_admin_bar( false );
        }
    }

    Let me know if it helps or not and I will get back to you.

    Regards!

    Hola sharmadpk03 estoy utilizando el tema Astra. No me funcionó el código que has enviado.
    Tendrás alguna alternativa?

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Remove top bar when logged in’ is closed to new replies.