Removing unnecessary code for Performance and Security

Removing unnecessary code for Performance and Security

A few lines of extra code in your header probably won’t slow your site down or risk performance, but you would like to keep things as clean and efficient as possible, since it only takes one line at the time to end up with a load of unnecessary code piled up on your wordpress blog, and that will surely slow it down from time to time.

This tip will not only help add up to your Blogs Security but will help with performance by removing unnecessary code from your Blog. Since WordPress uses the function wp_head() to add a bunch of code to the header of each page. Some of it is absolutely unnecessary.

By default, many WordPress themes include the version information in the document this information proves very useful for the hackers as they can easily target blogs that are using the older version of wordpress software. Here is what many themes use to display this info:

<meta name=”generator” content=”WordPress <?php bloginfo(‘version’); ?>” />

To prevent this information from being displayed in older themes, you can simply remove the previous line from your theme’s header.php file. In newer themes, however, the entire meta tag is generated by the wp_generator function from deep within the WordPress core. Fortunately it is just as easy to remove by adding the following line to your active theme’s functions.php file located in your WordPress theme folder:

<?php remove_action(‘wp_head’, ‘wp_generator’); ?>

The purpose for meta tags is to provide useful information to spiders and search engines. Meta tags do not display on a blog or website, but do display in the HTML or XHTML . Many meta tags are obsolete or do not serve any real useful purpose. You can remove these meta tags from your WordPress pages.

Trackbacks/Pingbacks

  1. 4 More Things You Should Remove From WordPress - [...] can check out a couple of interesting articles here and here for suggestions on removing unnecessary code from [...]

Submit a Comment

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>