Aleš Sýkora wrote

Disable WordPress admin bar for all except admins

17. 6. 2021 in

If you have your custom administration for users made with Toolset, you will propably need to hide the admin bar for your users except administrators. So if you have this question: “When you are logged in, the black wordpress top bar is showing up – is it possible to hide this bar for all users except the admin users?”

The answer is YES, you can hide admin panel with small snippet below:

// Your PHP code goes here!
add_action('after_setup_theme', 'remove_admin_bar');
 function remove_admin_bar() {
if (!current_user_can('administrator') && !is_admin()) {

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

More from category
Aleš Sýkora wrote
Basic SEO plugin with Toolset Types & Types Fields API
29. 9. 2018 in
Make your own SEO plugin with Toolset Types. No need to install any additional SEO plugins. Read our tutorial and make your own today!
Read More
Aleš Sýkora wrote
Change WordPress login logo with code
6. 11. 2020 in
Need to change wordpress login logo? Use this code in custom plugin or in Code Snippets plugin. Change the background image url to your image and Link Title to your site name for example.
Read More
Aleš Sýkora wrote
Use custom Javascript on form submission with Fluent Forms
15. 6. 2021 in
If you need to use your custom script on form submission and using Fluent Forms, use this code in your form’s custom JS settings.
Read More
magnifiercross linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram