Categories
Programming

WordPress: Remove admin bar in front-end

To remove Admin bar from WordPress front-end we can use WordPress filter hook: show_admin_bar.

In your theme functions.php file add following piece of code.

This code will remove admin bar front all pages in front-end. We can also simplify the code like following. This will work same as previous code.

We can also use conditions while removing the admin bar. Like if we want to remove admin bar from a specific page. In following example we are removing admin bar form page with id 231 (as an example):

As you can see we can use simple code to remove admin front in WordPress. If you think we can use this hook in different conditions then please share in comment below.

Leave a Reply

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