So I just set up a fresh WordPress install and right away I realized that I need to remove that pesky toolbar at the top of the page, you know which one I mean, this bloody thing:
Every time I install a fresh WordPress installation I completely forget that I hate this darn thing. It’s like Groundhog Day, mostly because I tend to have the memory of a goldfish.* Every time I have to Google “hook to remove admin bar WordPress” and then go through all of the results which are mostly not what I am looking for, etc.
Solution? Well now that I have a personal blog, I should use it as a resource for myself, since nobody probably will read it any time soon. That being said, I drafted my own 2 line solution to add to my theme’s functions.php and know that I can just go to my blog next time I perform a fresh install of WordPress.
The code is as follows:
A quick explanation of the code, I created a function (remove_the_darn_admin_bar()) that returns false and hooked it into the filter “show_admin_bar.” In short, without getting into a detailed explanation about action vs. filter, that “passes data through” (hat tip to the WordPress codex). Essentially since I return “false” it puts in place of the show_admin_bar hook nothing, thus, no admin bar! Yay!