WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I know, wp_head() is important, but it inject so much crap into the header, i like to get it out... and just add manually the 2-3 line of code i need..

BUT, and there is always a but, i need the wordpress auto-generated code for :

<meta name="description" content="" />
<meta name="keywords" content="" />
<link rel='canonical' href='http://jlecologia.com/cms/' /> (why not!)
<meta http-equiv="Content-Language" content="fr-FR" />

How i can ask for the generation of that... ???? something like : bloginfo('name') will be fine for me


share|improve this question
andre You might get more targeted answers if you explain what's in the header that you don't want and what's missing that you do want. Right now it sounds like all you want are the <meta> and <link> elements above ... which is why @Wyck suggested the code to remove everything else. – EAMann Mar 17 '11 at 15:35
You also might get better answers if you didn't come off as being so angry and if you revised your title to something that didn't show your general ignorance of the utility you're lambasting. – John P Bloch Mar 17 '11 at 15:54
I follow your GREAT advices, and tremendous wisdom by including it, and removing stuff i dont need with remove_action... I will be less an asshole next time choosing wording more carefully, who live, learn !, thanks ! – menardmam Mar 17 '11 at 16:18
up vote 6 down vote accepted

You can remove some of the header stuff with the following.

// remove unncessary header info
function remove_header_info() {
    remove_action('wp_head', 'rsd_link');
    remove_action('wp_head', 'wlwmanifest_link');
    remove_action('wp_head', 'wp_generator');
    remove_action('wp_head', 'start_post_rel_link');
    remove_action('wp_head', 'index_rel_link');
    remove_action('wp_head', 'adjacent_posts_rel_link');
add_action('init', 'remove_header_info');

The default installation does not include stuff like meta keywords, so that is either a theme or plugin that you are using.

share|improve this answer
not my question, but will check it out... – menardmam Mar 17 '11 at 15:27
@marc This is an incomplete answer to your question. The real answer is: don't remove wp_head(). Wyck's suggestion will stop wp_head from inserting what you don't want without ruining your site's compatibility with virtually every javascript-based plugin in the repository. – John P Bloch Mar 17 '11 at 15:52
adding the action to init did not work for me; after_setup_theme works. (functions.php) – Aziz May 5 at 13:25

Have a look here: http://codex.wordpress.org/Plugin_API/Action_Reference/wp_head

Essentially you need to add an action for the wp_head hook, and (probably) remove the other actions that have been associated with the wp_head hook.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.