Skip to content

Instantly share code, notes, and snippets.

@davidsword
Last active February 3, 2018 03:07
Show Gist options
  • Save davidsword/82f1a1248904d4fd8df465dd5b3a453b to your computer and use it in GitHub Desktop.
Save davidsword/82f1a1248904d4fd8df465dd5b3a453b to your computer and use it in GitHub Desktop.
<?
// clean wordpress header: remove prev/nex tags
remove_action('wp_head', 'index_rel_link');
remove_action('wp_head', 'parent_post_rel_link', 10, 0);
remove_action('wp_head', 'start_post_rel_link', 10, 0);
remove_action('wp_head', 'adjacent_posts_rel_link', 10, 0);
// remove "junk" from header
add_filter('thematic_show_commentsrss', 'disable_stuff' );
add_filter('post_comments_feed_link', 'disable_stuff' );
add_filter( 'parent_post_rel_link', 'disable_stuff' );
add_filter( 'start_post_rel_link', 'disable_stuff' );
add_filter( 'previous_post_rel_link', 'disable_stuff' );
add_filter( 'next_post_rel_link', 'disable_stuff' );
add_filter('wp_headers', 'remove_x_pingback');
remove_action( 'wp_head', 'feed_links_extra', 3 );
remove_action( 'wp_head', 'feed_links', 2 );
remove_action( 'wp_head', 'rsd_link' );
remove_action( 'wp_head', 'wlwmanifest_link' );
remove_action( 'wp_head', 'index_rel_link' );
function remove_x_pingback($headers) {
unset($headers['X-Pingback']);
return $headers;
}
function disable_stuff( $data ) { return false; }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment