Skip to content

Instantly share code, notes, and snippets.

@cgiovanii
Created November 4, 2013 12:58
Show Gist options
  • Save cgiovanii/7302080 to your computer and use it in GitHub Desktop.
Save cgiovanii/7302080 to your computer and use it in GitHub Desktop.
php: bones_head_cleanup
/*********************
WP_HEAD GOODNESS
The default wordpress head is
a mess. Let's clean it up by
removing all the junk we don't
need.
*********************/
function bones_head_cleanup() {
// category feeds
// remove_action( 'wp_head', 'feed_links_extra', 3 );
// post and comment feeds
// remove_action( 'wp_head', 'feed_links', 2 );
// EditURI link
remove_action( 'wp_head', 'rsd_link' );
// windows live writer
remove_action( 'wp_head', 'wlwmanifest_link' );
// index link
remove_action( 'wp_head', 'index_rel_link' );
// previous link
remove_action( 'wp_head', 'parent_post_rel_link', 10, 0 );
// start link
remove_action( 'wp_head', 'start_post_rel_link', 10, 0 );
// links for adjacent posts
remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head', 10, 0 );
// WP version
remove_action( 'wp_head', 'wp_generator' );
// remove WP version from css
add_filter( 'style_loader_src', 'bones_remove_wp_ver_css_js', 9999 );
// remove Wp version from scripts
add_filter( 'script_loader_src', 'bones_remove_wp_ver_css_js', 9999 );
} /* end bones head cleanup */
// remove WP version from RSS
function bones_rss_version() { return ''; }
// remove WP version from scripts
function bones_remove_wp_ver_css_js( $src ) {
if ( strpos( $src, 'ver=' ) )
$src = remove_query_arg( 'ver', $src );
return $src;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment