> ## Documentation Index
> Fetch the complete documentation index at: https://kb.hosting.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Using PHP to disable WordPress admin bar for all users

> Learn how to disable the WordPress admin for logged-in users. This article shows you how to disable the admin bar using a simple single line PHP script

[WordPress](https://hosting.com/hosting/platforms/wordpress-hosting/managed-wordpress-hosting/) admin toolbar is visible to all logged in users by default. This admin bar allows users with the right roles to access admin are from the side. This article shows you how to disable the admin bar for all logged in users with a short PHP code

## Disable  admin bar for all WordPress users

<Warning>
  **Important**

  Always perform a backup before you make any changes to the theme files. If you break any codes, it will be easier to revert your site to its last good known state. Alternatively, you could also create a child theme. Read this link on how to create a child theme: [https://www.hosting.com/blog/wordpress-child-theme/](https://www.hosting.com/blog/wordpress-child-theme/)
</Warning>

Follow the steps below to edit your Theme setting file to disable adminbar in WordPress:

1. Log in to your [WordPress](/docs/wordpress1) site with an administrator account.

2. On the **Dashboard** in the left sidebar, click **Appearance**, and then click **Theme Editor**:\
   ![](https://static.hosting.com/kb/kb-wp-disableadminbar-6.png)

3. On the **Theme Editor**, select the **Theme** you want to edit from the dropdown:\
   ![](https://static.hosting.com/kb/kb-wp-disableadminbar-2.png)

4. The files for this selected theme are listed on the right column under **Theme Files**. Click on the file named "functions.php":\
   ![](https://static.hosting.com/kb/kb-wp-disableadminbar-5.png)

5. Insert the following code to the end of functions.php file and click Update File Button to save the changes:

```
add_filter( 'show_admin_bar', '__return_false' );
```

Before:\
![](https://static.hosting.com/kb/kb-wp-disableadminbar-1.png)

After:\
![](https://static.hosting.com/kb/kb-wp-disableadminbar-4.png)

## Related articles

* [Adding a custom logo to WordPress](/docs/adding-a-custom-logo-to-wordpress)

* [Configuring WordPress to always use SSL](/docs/configuring-wordpress-to-always-use-ssl)

* [CTA button shortcode on WordPress](/docs/cta-button-shortcode-on-wordpress)
