Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1411752
    Drascia
    Participant

    Hi,

    I am trying to remove the WP toolbar from all non-admin users and I’ve tried adding in the functions.php:

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

    … but it did not work. So then I tried adding this instead:

    
    add_filter('show_admin_bar', '__return_false');

    Still no luck… Please help? I have attached screenshots as well.

    URL: https://oec2018.ca

    #1411760
    Drascia
    Participant
    This reply has been marked as private.
    #1412029
    Christopher
    Moderator

    Hi there,

    Because this requires a template change, I’d advise that you setup a child theme. This allows you to make code changes that won’t be overwritten when an X update is released. After your child theme is setup, please review how we recommend making template changes in Customization Best Practices.

    After activating child theme, please add your code in child theme’s functions.php file.

    Thanks.

    #1412105
    Drascia
    Participant

    Hey again,

    I’ve installed the child theme, but still no luck! What could be going wrong?

    Thanks

    #1412211
    Thai
    Moderator

    Hi There,

    I navigated to this page: https://oec2018.ca/wp-admin/admin.php?page=rua-settings

    After that checked on the Hide Admin Toolbar for Users option, the WP Admin bar disappeared.

    Regards!

    #1412246
    Drascia
    Participant

    Hi,

    That’s fine but what happened to my website?? Everything is out of place now.

    #1412253
    Drascia
    Participant

    Please disregard, everything has worked out. Thank you very much for your help!

    #1412642
    Thai
    Moderator

    It could be the plugin conflicted with your custom code.

    If you need anything else please let us know.

  • <script> jQuery(function($){ $("#no-reply-1411752 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>