Remove top bar for non logged in users

This topic contains 4 replies, has 2 voices, and was last updated by  Emma Johnson 4 years, 6 months ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
  • Author
    Posts
  • #542098

    Emma Johnson
    Expired Member
    Post count: 23

    How can I remove the top bar for non logged in users?

    You can see this at http://isleofdog.co.uk and it says ‘Login’ on the left and ‘What the File’ on the right. I don’t want people to login, so this whole section is not needed. I tried removing in css, but then it removed for admins when logged in, which wasn’t ideal…

    #542114

    Alex Rollin
    Moderator
    Post count: 27815

    GD doesn’t have a setting to hide the admin bar but there is a snippet:

    
    
    
    function uwp_disable_admin_bar() {
    	if (current_user_can('administrator') || current_user_can('editor') ) {
    		show_admin_bar(true);
    	} else {
    		show_admin_bar(false);
    	}
    }
    add_action('after_setup_theme', 'uwp_disable_admin_bar');
    

    Snippet? Add them with Code Snippets: https://wordpress.org/plugins/code-snippets/

    #543459

    Emma Johnson
    Expired Member
    Post count: 23

    I have added this snippet using the plugin that you suggested, but it still isn’t working. Am I missing anything?

    #543486

    Alex Rollin
    Moderator
    Post count: 27815

    I recommend you get a 3rd party plugin to manage it, then

    https://www.google.com/search?&q=wordpress+hide+admin+bar+plugin

    #543509

    Emma Johnson
    Expired Member
    Post count: 23

    Thank you! I installed ‘Hide Admin Bar Based on User Roles’ and it works perfectly! ☺️

Viewing 5 posts - 1 through 5 (of 5 total)

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
20% Discount Offer
Hurry! Get your 20% discount before it expires. Get 20% Discount