Tuesday, 4 September 2018

Clean up WordPress Theme HEAD Section and Unneeded JS & CSS Files


WordPress core ads quite a lot of code in site’s HTML head section whether you want it or not. That code is far from useless and serves a purpose on most sites. However, if you are a clean-code freak or using WordPress to power a SaaS you’ll want to clean up the HTML. As with most things in WP, it’s just a matter of removing a few actions and filters. Why would I remove those tags in HEAD, CSS or JS files?
There are a couple of reasons. Some people like to keep their code and sites as tidy as possible. Why have a line of code in HTML if you know you don’t need it and know how to remove it. No reason what so ever. Same goes for extra CSS and JS files. If you’re not using emojis on your site why would you include that JS on every page?
Then there’s security. There are a few pieces of HTML that WordPress automatically adds do show URLs that have been exploited in the past. I have to stress out that these URLs (XML RPC endpoint in particular) are not a secret. They should be public. But, changing them to something custom, and hiding them is a known practice. In that case, it’s obvious you don’t want those URLs in your HTML.
Speed is also a
Source: https://managewp.org/articles/17836/clean-up-wordpress-theme-head-section-and-unneeded-js-css-files



source https://williechiu40.wordpress.com/2018/09/04/clean-up-wordpress-theme-head-section-and-unneeded-js-css-files/

No comments:

Post a Comment