Vannkorn

Full Stack Web Developer

Close

Remove admin bar from front end

We can do that by just adding a filter function below to your theme functions.php file.

Ads: Register now via this link to receive $300 credit from Vultr

The admin bar of a WordPress website by default shows when the user has logged in to the site and visited its front end. This is helpful when the user wants to switch quickly back and forth between the front end and the back end.

However, in some cases viewing the admin bar when logged in can be a security risk, as it provides access to sensitive information such as the installed plugins and links to update your account detail.

Furthermore, It can be distracting for users who are not administrators, as it shows them links to various administrative functions that they may not need or want to access.

Moreover, It can slow down your website, as it is an additional element that needs to be loaded every time a page is viewed.

How to disable the WordPress admin bar for yourself

You can disable this manually by going to your Profile => Editor Profile that locates at the top-right corner of your WordPress Dashboard screen.

From the Toolbar option untick Show Toolbarwhen viewing site. Click on the Update Profile button at the bottom-most of the page and you’re done.

How to disable the WordPress admin bar for everyone

How if you don’t want everyone that has admin access to the WordPress dashboard to manually update their profile?

We can do that by just adding a filter function below to your theme functions.php file.

/**
 * Remove admin bar from frontend
 */
add_filter('show_admin_bar', '__return_false');

Leave a Reply

Your email address will not be published. Required fields are marked *