Created
April 21, 2012 11:37
-
-
Save florieger/2436725 to your computer and use it in GitHub Desktop.
Remove output of WordPress head
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php // This File will be read by the wordpress engine, handle with care | |
// =============== Remove some output of the wp_head() function =============== | |
remove_action( 'wp_head', 'wp_generator' ); // Remove the WP version in the generator tag | |
remove_action( 'wp_head', 'feed_links', 2 ); // Remove the links to the general feeds: Post, Comment and Alternate feed | |
remove_action( 'wp_head', 'feed_links_extra', 3 ); // Remove the links to the extra feeds such as category feeds | |
//remove_action( 'wp_head', 'rsd_link' ); // Remove the link to the Really Simple Discovery service endpoint, EditURI link | |
//remove_action( 'wp_head', 'wlwmanifest_link' ); // Remove the link to the Windows Live Writer manifest file | |
remove_action('wp_head', 'rel_canonical'); // Remove canonical link | |
add_filter('previous_post_rel_link', 'ac_remove_helper' ); // Remove previous link | |
add_filter('next_post_rel_link', 'ac_remove_helper' ); // Remove next link | |
// Helper function for remove actions | |
function ac_remove_helper($data) { | |
return false; | |
} | |
// Untestet stuff | |
//remove_action( 'wp_head', 'index_rel_link'); // Remove index link | |
//remove_action( 'wp_head', 'adjacent_posts_rel_link', 10, 0 ); // Remove relational links for the posts adjacent to the current post. | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I have no idea, why the following implementation is not working (at least not for me):
But I found the helper method solution, which works fine :)