WordPress is great. I work with it every day of my life. I’ve always been an incredibly neat person, and I’ve found that WordPress does a really bad job of keeping the <head> neat. When you “View Source” or check out the DOM in Chrome Developer Tools, you can immediately tell its a WordPress site with all the junk that’s injected in as meta data.
I’m sure the core team had their reasons, but a large majority of the tags that get inserted are relatively useless, and only really sufficed for legacy sites and services. Whats more, is that if you’re building a site on WordPress and have removed the blog functionality from it completely, well then, you’re not going to have much use for a lot of the meta that you get by default.
So, without further ado, here’s some code I use on every project that cleans up the WordPress <head> nicely:
You can add the above function in your functions.php, and you should have a much cleaner <head> to work with. To help me out, I put together whats known as a WordPress Library. This library is a file I can include in every single one of my projects through Composer which is simply required at the top of my functions file.
Here’s the link to the Git repository which I’m still putting together!