WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Remove <meta name="generator" content="WordPress 2.5" /> (21 posts)

  1. WoodiE
    Member
    Posted 6 years ago #

    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.

  2. Samuel Wood (Otto)
    Tech Ninja
    Posted 6 years ago #

    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');

  3. WoodiE
    Member
    Posted 6 years ago #

    Got it - thanks!

  4. ethoslight
    Member
    Posted 6 years ago #

    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!

  5. ethoslight
    Member
    Posted 6 years ago #

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

  6. creativeworldstudio
    Member
    Posted 6 years ago #

    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.

  7. designer310310
    Member
    Posted 6 years ago #

    It instantly worked, thanks Otto42!

  8. vavroom
    Member
    Posted 6 years ago #

    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.

  9. @mercime
    Volunteer Moderator
    Posted 6 years ago #

    Thank you Otto42. You're the best!

  10. christykny
    Member
    Posted 5 years ago #

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

    Thanks!

    Christy

  11. christykny
    Member
    Posted 5 years ago #

    Got it. Thanks, Otto

  12. Dgold
    Member
    Posted 5 years ago #

    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?

  13. Dgold
    Member
    Posted 5 years ago #

    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/

  14. Safirul Alredha
    Member
    Posted 5 years ago #

    function remove_generator() {
    	return '';
    }
    
    add_filter('the_generator', 'remove_generator');
    
  15. Dgold
    Member
    Posted 5 years ago #

    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?

  16. horizon70s
    Member
    Posted 5 years ago #

    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

  17. micasuh
    Member
    Posted 5 years ago #

    I will verify this works with 2.7 as well! I had the same error as ethoslight but found out it was because of extra spaces after the ?> in my php. Deleting the extra space fixed my problem! Thanks for this thread!

  18. MvdL79
    Member
    Posted 5 years ago #

    Okay I am using WordPress 2.7 along with Deepstack theme and I tried adding the following codes to my theme's functions.php:

    remove_action('wp_head', 'wp_generator');

    and I also tried:

    <?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');
    ?>

    But both didn't do anything, I still get the following line when I look at the source of my page:

    <meta name="generator" content="WordPress 2.7" />

    Can someone please help me out? It should be hidden with the previous mentioned code parts, right? :S

  19. MvdL79
    Member
    Posted 5 years ago #

    Can't I just change the header.php (from the theme)?

    <meta name="generator" content="WordPress <?php bloginfo('version'); ?>" />

    If I would change that, that wouldn't result in nasty problems right?

  20. MvdL79
    Member
    Posted 5 years ago #

    Fixed it as described above.

  21. altrd
    Member
    Posted 5 years ago #

    Found this...

    function rm_generator_filter() { return ''; }
    
    if (function_exists('add_filter')) {
      $types = array('html', 'xhtml', 'atom', 'rss2', /*'rdf',*/ 'comment', 'export');
    
      foreach ($types as $type)
        add_filter('get_the_generator_'.$type, 'rm_generator_filter');
    }

    More @ http://www.christianschenk.org/blog/removing-wordpress-generator-meta-tag-completely/comment-page-1/#comment-4917

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.