Removing the WordPress 3.1 Toolbar

Last week the Automattic has released another update to WordPress, where one of the main innovations is a management bar horrible which is floating on the top screen. The appeal was imported from and now comes automatically enabled in version 3.1 of the CMS.

A bar of these can even be useful for administrators, but the space it occupies on the screen does not justify the resources it offers to ordinary users. Some readers of TB until they liked the resort, but we thought it best to please remove most. Even because the rod is a feature of WordPress and would not appear in the forum TB.

Disable per user

If you do not like to put the hand in code, you can disable the bar in the WordPress admin interface. The downside is that it only hides the bar for your user, requiring that all users registered on your blog to make the same setting in their profile (assuming your blog accept registration of players).

The option appears in the profile editing tab (there where you change your name and everything, you know?). Check the print:

Disable for all users at once

This option requires you to put your hands dirty. But it’s very simple (even). All you need to do is open the file functions.php of your theme and paste the following line:

add_filter(‘show_admin_bar’, ‘__return_false’);

Enable only for the Admin user

You can use the above function so that it only applies to specific users. To do this simply create a condition using the function get_current_user_id() WordPress. See the example:

if (get_current_user_id() != 1) {
add_filter(‘show_admin_bar’, ‘__return_false’);

In the first line of the code above we checked the ID and user access. Each registered user on the blog has a specific ID, and the user ID admin will always be the number 1 (the first registered user on the blog).

Thus, the above code does is check if the user is loading pages is the admin. If not, the script applies the removal filter bar.

Again, just copy and paste the above code in functions.php.

Enable for all editors

With this function you can activate the bar for all blog authors. The logic is the same as the code above, but this time use a function that checks the user’s permissions – current_user_can(). See how is the code:

if(! current_user_can(‘publish_posts’) ) {
add_filter(‘show_admin_bar’, ‘__return_false’);

In the above code we check whether the user has permissions to publish posts. If he does not possess, we apply the removal of the filter rod.


You can play with these functions in different ways – you can do magical things with the functions.php file. Anyway, these three options should be sufficient for most users.

And if you implement it in a different way from those explained in the post, do not forget to post in the comments.