Snippet: DisableWP admin bar
To disable the WP Admin Bar (tidies up your dashboard), simply add the following PHP to your code snippet plugin. Add <?– and closing ?> if you are doing this outside of a plugin.
/* Disable WordPress Admin Bar for all users except Admin */ add_action('after_setup_theme', 'remove_admin_bar'); function remove_admin_bar() { if (!current_user_can('administrator') && !is_admin()) { show_admin_bar(false); } }
Author: admin
Uploaded: 4 October 2023