Home > How To > Removing Wordpress Version From Your Header Source Code

Removing Wordpress Version From Your Header Source Code

Posted by: Mark

wpversionnumber 300x15

WordPress version number in your header is a potential security risk and in my opinion should be removed. Removing it can be done either one of two ways.

1. Remove From Your Header.php Source

If your version number is displayed via your header.php it will be displayed something like this.

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

Removing this is done by deleting that line of code from header.php.

2 . Remove Using Your Theme Functions.

Sometimes the version number is displayed via WordPress internal structure code.
<?php wp_head(); ?> Do not remove this from your header.php

Instead to remove  you will need to place this code in your theme functions.php file.

remove_action('wp_head', 'wp_generator')

You will need to place it inside php tags at the end of the functions.php file. Like below.

<?php remove_action('wp_head', 'wp_generator'); ?>

Bookmark or Share This Post
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • Technorati
  • Add to favorites
  • email

Filed Under: How To, Tips & Tricks, Wordpress

Follow Me!

Comments (8)

 

  1. Janine says:

    I didn’t realise this is security risk. Can you explain more.

  2. Mark says:

    Hi Janine thanks for stopping by. The issues is that when you display your wp version in your header you are exposing the version to a would be hacker. This then means if they know of an exploit to that particular version they can take advantage of it quite easily. Hope this helps.

  3. Hey Mark,

    Quick questions.

    Is there anyway to remove all the references to wordpress in the source code?

    I’m think that before I use the lines of code that you gave that I would ask first since what I’m asking could be done all at once.

    I’ll watch for your reply.

    Thanks,

    Mark

  4. Mark says:

    Most of the references to WordPress in source code need to be there as it’s the way the CMS is built, files and folder locations etc. Out of all CMS’s I think WP is in fact also the most easy to recognise from the code. I hope it doesn’t trouble you too much :-) . Mark

  5. Thanks for the fast reply!

    The only reason I asked was I thought it would look better for my sites if people couldn’t tell that it was built on a blogging platform. More professional. But I think with how easy wp is and all the support out there for it that having it show up in my source code isn’t that big of a deal I guess :-) .

    Thanks again,

    Mark

  6. Mark says:

    oh I had gussed you might have found the references to WordPress in the code a little bit demeaning of your hard work. Although I’d be more inclined to feel impressed that I used WP over anything else as it really is a SUPER CMS/Blogging Platform.

  7. Mark says:

    Oh and I just realised your ad’s site is made using WordPress. Looks really good, great work.

  8. “Oh and I just realised your ad’s site is made using WordPress. Looks really good, great work.”

    Thanks! That’s what I’m going for :-)

    I think there is some useful stuff on your site, I’ll be sure to stick around and see what I can dig up.

    Take care,

    -Mark

Got Something On Your Mind?

Feel free to leave a comment, all are very welcome. Thank You.