Skip to content

Instantly share code, notes, and snippets.

@tsquez
Last active December 10, 2015 14:25
Show Gist options
  • Save tsquez/96c373f6c9af085ebbfd to your computer and use it in GitHub Desktop.
Save tsquez/96c373f6c9af085ebbfd to your computer and use it in GitHub Desktop.
This will remove a lot fo unnecessary junk from the header
if ( ! function_exists( 'wpforge_head_clean' ) ) :
function wpforge_head_clean() {
// Remove the links to the extra feeds such as category feeds
remove_action( 'wp_head', 'feed_links_extra', 3 );
// Remove the links to the general feeds: Post and Comment Feed
remove_action( 'wp_head', 'feed_links', 2 );
// Remove the link to the Really Simple Discovery service endpoint, EditURI link
remove_action( 'wp_head', 'rsd_link' );
// Remove the link to the Windows Live Writer manifest file.
remove_action( 'wp_head', 'wlwmanifest_link' );
// Remove index link
remove_action( 'wp_head', 'index_rel_link' );
// Remove prev link
remove_action( 'wp_head', 'parent_post_rel_link', 10, 0 );
// Remove start link
remove_action( 'wp_head', 'start_post_rel_link', 10, 0 );
// Canonical.
remove_action( 'wp_head', 'rel_canonical', 10, 0 );
// Shortlink.
remove_action( 'wp_head', 'wp_shortlink_wp_head', 10, 0 );
// Links for adjacent posts.
remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head', 10, 0 );
// Remove relational links for the posts adjacent to the current post.
remove_action( 'wp_head', 'adjacent_posts_rel_link', 10, 0 );
// Emoji detection script.
remove_action( 'wp_head', 'print_emoji_detection_script', 7 );
// Emoji styles.
remove_action( 'wp_print_styles', 'print_emoji_styles' );
// Remove the XHTML generator that is generated on the wp_head hook, WP version
remove_action( 'wp_head', 'wp_generator' );
}
endif;
@tsquez
Copy link
Author

tsquez commented Apr 6, 2015

Just add this to functions.php of your theme and a lot of unnecessary items will be stripped from the header.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment