Forums

Manipulating wp_head function (7 posts)

  1. l2yanuk
    Member
    Posted 3 years ago #

    Hi everyone,

    I'm using the all-in-one-seo plugin and what I'm wanting to do is move that to the top of the wp_head menu when it renders the html. Currently the wp_head seems to display like this:

    <link rel="EditURI" type="application/rsd+xml" title="RSD" href="http://www.example.com/xmlrpc.php?rsd" />
    <link rel="wlwmanifest" type="application/wlwmanifest+xml" href="http://www.example.com/wp-includes/wlwmanifest.xml" />
    <script type='text/javascript' src='http://www.example.com/wp-includes/js/jquery/jquery.js?ver=1.2.3'></script>
    <meta name="generator" content="WordPress 2.5.1" />
    
    <!-- all in one seo pack 1.4.6.8 [221,285] -->
    <meta content="index, follow" name="robots" />
    <meta name="description" content="description" />
    <meta name="keywords" content="lots, of, key, words" />

    but I'm wanting to turn it round so it looks like this instead...

    <!-- all in one seo pack 1.4.6.8 [221,285] -->
    <meta content="index, follow" name="robots" />
    <meta name="description" content="description" />
    <meta name="keywords" content="lots, of, key, words" />
    <!-- end of all in one seo -->
    
    <link rel="EditURI" type="application/rsd+xml" title="RSD" href="http://www.example.com/xmlrpc.php?rsd" />
    <link rel="wlwmanifest" type="application/wlwmanifest+xml" href="http://www.example.com/wp-includes/wlwmanifest.xml" />
    <script type='text/javascript' src='http://www.example.com/wp-includes/js/jquery/jquery.js?ver=1.2.3'></script>
    <meta name="generator" content="WordPress 2.5.1" />
  2. d7nh
    Member
    Posted 3 years ago #

    I can tell you can just forget about it because wp_head will call your plugin's scripts after itself, if you remove wp_head no plugin's scripts will be called

    btw the wp_head is in default-filter.php in wp-includes

  3. rko618
    Member
    Posted 3 years ago #

    I would also like to do this. YSlow advises placing all your stylesheets includes before javascript includes. However due to the automatic nature of wp_head I am unable to do anything about this.

  4. hilj
    Member
    Posted 3 years ago #

    btw the wp_head is in default-filter.php in wp-includes

    Thanks for this! I was bummed by the fact that the wp_head spews out the version number. I just commented the wp_genareator like this: add_action('wp_head', '/*wp_generator*/');

    But, is there a way to change this without changing the file? Cause after an update I'll have to change it back.

    Thanks

  5. caemusic
    Member
    Posted 3 years ago #

    yep, there is a plugin to remove the generator meta tag:

    http://www.christianschenk.org/blog/removing-wordpress-generator-meta-tag-completely/

  6. hilj
    Member
    Posted 3 years ago #

    Doing this ('wp_head', '/*wp_generator*/'); wasn't a good idea after all. It worked locally, but on my server it gave an error message. Just to let you know.

  7. brad_frost
    Member
    Posted 3 years ago #

    remove_action('wp_head', 'wp_generator');

    This code worked for me. I placed it inside my theme's functions.php file. The same method works for removing other actions, such as

    remove_action('wp_head', 'wlwmanifest_link');
    remove_action('wp_head', 'locale_stylesheet');
    etc

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags