This topic has 11 replies, 4 voices, and was last updated 6 years by Abe.

  • Author
  • #1987
     Harvinder
    Participant

    Hi,

    How do I remove the admin bar for all users apart from the “Admin”?

    I have tried: WP Admin -> Sweetdate -> Miscellaneous -> Admin toolbar -> Off

    but this doesnt work.

    How do i achieve this?

    Thanks
    Harvinder

    #1992
     SQadmin
    Keymaster

    That normally works. Do you have any plugins that could set the admin bar?

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #2000
     Harvinder
    Participant

    Hi,

    When I set the settings to off, the admin bar is removed from the front-end for all users.

    HoweverIi still want it visible for the Admin only.

    Thanks
    Harvinder

    #2010
     SQadmin
    Keymaster

    If you want it only for site admins add this code to sweetdate-child/functions.php

    COPY CODE
    
    /* Amin bar only for admin */
    add_action('after_setup_theme','kleo_my_bar');
    function kleo_my_bar(){
        if (is_super_admin())
        {
            add_action('wp_footer','wp_admin_bar_render',1000);
            add_filter('show_admin_bar', '__return_true');
        }
    }
    

    Make sure to have the sweetdate-child theme activated for it to work

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Ticket solution
    #2186
     girlinparis
    Participant

    What do you use for any logged in users? I tried

    if (is_site_user()) and it broke. lol

    Just curious if you know off the top of your head. I’ll keep looking in Codex. 🙂

    #2187
     SQadmin
    Keymaster

    is_user_logged_in()
    🙂

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #2189
     girlinparis
    Participant

    I knew it! I knew you would beat me to it!

    #2194
     girlinparis
    Participant

    It broke again 🙁 header already defined in pluggable.php

    #2217
     SQadmin
    Keymaster

    I don’t know what you are trying to achieve. Paste your code here. I am sure it has something misspelled.

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #2218
     girlinparis
    Participant

    I only wanted the admin bar to show for users logged in. I have it fixed though.

    #188242
     Harvinder
    Participant

    Hi,

    Whats the updated code snippet? Im using the previously mentioned one and I have upset site_admin to super_admin but it is not working?

    #188679
     Abe
    Keymaster

    Hi, just updated it using is_super_admin()

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    ---
    @ SeventhQueen we do our best to have super happy customers. Thanks for being our customer.

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

The forum ‘Sweetdate – WordPress’ is closed to new topics and replies.

Log in with your credentials

Forgot your details?