Clean Up wp_head

Clean Up wp_head

WordPress will by default output quite a lot of unnecessary stuff on the document header with the wp_head() function.

Let’s start removing them. Put following codes to your functions.php, a recommended way is to hook to the after_setup_theme action.

Comment line by line.

L1: The RSD(Really Simple Discovery) is an API to edit your blog from external services and clients. If you edit your blog exclusively from the WP admin console, you don’t need this.

L2: You really don’t need this either if you are not using Windows Live Writer for your WordPress blog.

L3: If you look at the source of your site, you’ll notice that there is a meta tag generating the WordPress version your site is installing on. This piece of codes removes the tag in case you don’t want to let the world know your site is on WordPress.

L4-L6: They are to remove the next/previous post link and homepage link on document header. Please note that this has nothing to deal with the “next/previous” post that you may want to add at the end of each post.

L7: This is to remove the “shortlink” added by wp_shortlink_wp_head.

In addition to above cleanup, you may also want to remove the Emoji styles and JS. Check my previous post on this.


Author: Leo

My name is Leo who’s behind this blog. I’ve been working with wordpress since 2010. I’ll write about themes, plugins, tutorials and all about wordpress here. Hope you find it useful!

Leave a Reply

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