How to Toggle on and Off the WordPress Admin Bar at Top of The Page?

Posted by

toggle wordpress admin bar

Table of Contents

WordPress is a popular content management system that allows users to create and manage websites with ease. One of the features that WordPress offers is the admin bar, which appears at the top of the screen when a user is logged in. The admin bar provides quick access to various features and settings, making it a valuable tool for site administrators. However, there may be times when you want to toggle the admin bar on or off, depending on your needs. In this article, we’ll explore how to toggle the WordPress admin bar on and off.

What is the WordPress Admin Bar?

The WordPress admin bar is a toolbar that appears at the top of the screen when a user is logged in to the WordPress dashboard. The admin bar provides quick access to various features and settings, including the site’s front end, the dashboard, the user profile, and more. The admin bar also provides shortcuts to common actions, such as adding a new post or page.

How to Toggle the WordPress Admin Bar On and Off

There are a few different ways to toggle the WordPress admin bar on and off. Here are some methods you can try:

Method 1: Using the User Profile Setting

The easiest way to toggle the WordPress admin bar on and off is to use the User Profile setting. Here’s how:

  1. Log in to your WordPress dashboard.
  2. Click on “Users” in the left-hand menu.
  3. Click on your user profile.
  4. Scroll down to the “Toolbar” section.
  5. Check or uncheck the box next to “Show Toolbar when viewing site” to toggle the admin bar on or off.
  6. Click “Update Profile” to save your changes.

Method 2: Using the Code Editor

If you’re comfortable editing code, you can toggle the WordPress admin bar on and off by adding a few lines of code to your site’s functions.php file. Here’s how:

  1. Log in to your WordPress dashboard.
  2. Click on “Appearance” in the left-hand menu.
  3. Click on “Theme Editor.”
  4. Click on the “functions.php” file in the right-hand menu.
  5. Add the following code to the file:
/* Disable WordPress Admin Bar for All Users Except for Administrators. */
if (!current_user_can('administrator')) {
add_filter('show_admin_bar', '__return_false');
}
  1. Click “Update File” to save your changes.

This code will disable the WordPress admin bar for all users except for administrators.

Method 3: Using a Plugin

Finally, you can toggle the WordPress admin bar on and off using a plugin. There are several plugins available that can help you do this, including:

  • WP Hide Admin Bar: This plugin allows you to hide the WordPress admin bar from non-administrator users.

To install a plugin, follow these steps:

  1. Log in to your WordPress dashboard.
  2. Click on “Plugins” in the left-hand menu.
  3. Click on “Add New.”
  4. Search for the plugin you want to use.
  5. Click “Install Now” and then “Activate” to activate the plugin.
  6. Follow the plugin’s instructions to toggle the WordPress admin bar on and off.

Conclusion

The WordPress admin bar is a useful tool that can help you manage your site more efficiently. Whether you want to toggle the admin bar on or off depends on your needs. Fortunately, there are several ways to do this, including using the User Profile setting, editing code, or using a plugin. By following these methods, you can easily toggle the WordPress admin bar on and off, depending on your preferences.

Join Our Community

Subscribe to Go With Blogs for regular updates.

You may be interested in