WordPress adds a lot of various stuff to your website’s header source using the wp_head() action hook. Well, some of what is generated you may want, there maybe some that you don’t. So, let me show you how to remove what you don’t want.

Usage

We’ll be using the remove_action() function, which has a usage of:

remove_action( $tag, $function_to_remove, $priority );

The removeaction() function will remove a specified action hook. So, in the above example, the $tag will always be wphead in this article. Next is the $functiontoremove, which will be different in this article and will be what you want to remove. Afterwards is $priority, which is the priority of the function, as defined when the function was originally hooked.

The Examples

Add the ones you want to your theme’s functions.php file.

 // Remove the link to Really Simple Discovery remove_action( 'wp_head', 'rsd_link' );

 // Remove the link to the Windows Live Writer manifest file remove_action( 'wp_head', 'wlwmanifest_link' );

 // Remove the WordPress generator tag remove_action( 'wp_head', 'wp_generator' );

 // Remove previous link remove_action( 'wp_head', 'parent_post_rel_link' );

 // Remove relational link for the first post. remove_action( 'wp_head', 'start_post_rel_link' );

 // Deprecated function. Removes rel navigation links. remove_action( 'wp_head', 'index_rel_link' );

 // Remove relational links for the posts adjacent to the current post remove_action( 'wp_head', 'adjacent_posts_rel_link' );

 // Removes the rel=shortlink of a shortlink remove_action( 'wp_head', 'wp_shortlink_wp_head' );

 // Remove the links to the general feeds. remove_action( 'wp_head', 'feed_links', 2);

 // Remove the links to the extra feeds such as category feeds. remove_action( 'wp_head', 'feed_links_extra', 3);