Home » Functions » is_admin_bar_showing

Function Name: is_admin_bar_showing

Today, we will be discussing the is_admin_bar_showing function in WordPress. This function checks if the admin bar is showing on the front end of the site.

The WordPress admin bar is a handy toolbar that appears at the top of a site when an administrator is logged in. This bar provides quick access to important features such as editing pages, creating new posts, and managing comments.

Sometimes, you may want to customize your WordPress site based on whether the admin bar is visible or not. This is where the is_admin_bar_showing function comes in handy. This function returns true if the admin bar is visible, and false if it is not.

Example Usage:

Let’s say you want to display a custom message to your website visitors when the admin bar is visible. You could use the is_admin_bar_showing function in combination with an if statement to achieve this.

if ( is_admin_bar_showing() ) {
    echo "Welcome to our website! We hope you enjoy your stay.";
} else {
    echo "Welcome to our website!";

In the example code above, we check if the admin bar is visible using the is_admin_bar_showing function. If it is visible, we display a custom message that includes a friendly greeting and an invitation to explore the site. If it is not visible, we display a simpler message that still welcomes visitors to our site.

In conclusion, the is_admin_bar_showing function is a useful tool for developers who need to customize their WordPress site based on whether the admin bar is visible or not. With this function, you can create a more personalized experience for your website visitors and make your site stand out from the crowd.

Learn More on

Register an account to save your snippets or go Pro to get more features.