WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] Remove <meta name=”generator” content=”WordPress 2.5″ />

[Resolved] Remove <meta name=”generator” content=”WordPress 2.5″ />

  • Just upgraded to WordPress 2.5, after doing so the following was added to my source code:

    <meta name=”generator” content=”WordPress 2.5″ />

    This is no where in my theme as I’ve removed it in the past, however this doesn’t seem to be in the themes anymore. How can I remove or edit this line of code?

    At the very least I want to remove the version number.

Viewing 15 replies - 1 through 15 (of 20 total)
  • The generator stuff was moved into the core and standardized, since so many themes did it differently that it didn’t make much sense anymore.

    You can remove it by adding this to your theme’s functions.php:
    remove_action('wp_head', 'wp_generator');

    Got it – thanks!

    Woops! I tried what you described Otto42, then removed it after I refreshed my front page and saw it skewed some things in the theme. After I removed it and checked the page again it looked OK, however, when I try to go to the Dashboard (wp-admin) I get this error message:

    Warning: Cannot modify header information – headers already sent by (output started at /home/username/public_html/bloglocation/wp-content/themes/themename/functions.php:6) in /home/username/public_html/bloglocation/wp-includes/pluggable.php on line 689

    I tried browsing pluggable.php to see if I could find anything, but alas, I am overwhelmed. Any advice?

    Thanks!

    OK, resolved. Had to disable all plugins, then log out to fix.

    Thanks Otto… a great and simple fix 🙂

    @ethoslight – Your error could be caused by spaces ” ” in your functions.php file. I had this and just removed the space in Otto’s code.

    It instantly worked, thanks Otto42!

    Well, I was going to say “it doesn’t work”, but then, after about 15 minutes of fiddling, and editing functions.php, I realised that I was making changes to my *local* copy, but looking at the live site!!!

    Well, it did work, thank you for a most simple solution.

    Thank you Otto42. You’re the best!

    christykny

    @christykny

    Can anyone tell me where in the functions.php I would put the snippet of code suggested by Otto?

    Thanks!

    Christy

    christykny

    @christykny

    Got it. Thanks, Otto

    After Otto42’s functions.php method, I found that <meta name="generator" content="WordPress 2.6.5" /> still appears in Feeds.

    Do you know how to remove it from WP-generated RSS & Atom Feeds too?

    I found some info on removing Generator metaname from feeds.

    You can put all this in your Functions.php to hide generator metaname, hide WP version number, remove the hooks for remote-blogging with Windows Live Writer, for whatever reasons such as maybe security or just privacy or reducing clutter,

    <?php remove_action('wp_head', 'wp_generator'); 
    
    // Remove Windows Live Writer link in header
    // Do Not do this if you use it
    remove_action('wp_head', 'wlwmanifest_link');
    remove_action('wp_head', 'rsd_link'); 
    
    // Remove WP version info
    function hide_wp_vers()
    {
        return '';
    } // end hide_wp_vers function
    
    add_filter('the_generator','hide_wp_vers');
    ?>

    That is a complete functions.php file.

    Thanks to this site for some of the tips,
    http://www.kennycarlile.net/2008/06/18/remove-generator-field-from-wordpress-meta/

    function remove_generator() {
    	return '';
    }
    
    add_filter('the_generator', 'remove_generator');
    

    thanks zeo I was just discovering that answer on another blog, and just tested it — works as expected.

    Anyone have an opinion on whether it would be good to hardcode generator= Blog Name, into the header.php or something?

    Example,
    <meta http-equiv="generator" content="<?php bloginfo('name'); ?>" />

    wouldn’t hurt anything would it?

    I get this?

    I get this after adding to my functions.php file:

    Fatal error: Call to undefined function remove_action() in /pathto/wp-includes/functions.php on line 25

Viewing 15 replies - 1 through 15 (of 20 total)
  • The topic ‘[Resolved] Remove <meta name=”generator” content=”WordPress 2.5″ />’ is closed to new replies.
Skip to toolbar