13 Tags to Delete From your Theme

Snip the superflous. Free themes are designed to be as easy to install as possible. You simply upload your theme, activate it, and you're done. It knows your blog's name, description, feed URL and everything else.

In order to know all of this, the theme uses PHP tags to get the information. However, it has to use these tags every time a page is loaded.

As most of the information never changes, you can delete these tags from your theme, and replace them with normal text. That way, your server has less to process next time around.

13 Common Tags in WordPress Themes

The easiest way to replace the tags is to load up a page from your blog, then "View Source." Now go through your theme and look for the following tags, then find what each tag corresponds to in your page source. Paste the text from the page source over the theme tags.

Save the files after every change and check that the new version of the page is identical to the old.

  1. <?php language_attributes(); ?> found in header.php.
  2. <?php bloginfo('html_type'); ?> found in header.php.
  3. <?php bloginfo('charset'); ?> found in header.php.
  4. <?php bloginfo('name'); ?> found throughout the theme.
  5. <meta name="generator" content="WordPress <?php bloginfo('version'); ?>" /> <!-- leave this for stats --> found in header.php. If you're using a 3rd party stats program (like Google Analytics) then you've nothing to worry about, and if your version of WordPress is out of date, you won't want hackers knowing that.
  6. <?php bloginfo('stylesheet_url'); ?> found in header.php.
  7. <?php bloginfo('rss2_url'); ?> founder in header.php, sidebar.php and footer.php. Be careful if you switch to FeedBurner after doing this. Make sure you remember to update the feed URL here manually (The FeedSmith plugin won't do it anymore).
  8. <?php bloginfo('pingback_url'); ?> found in header.php.
  9. <?php bloginfo('stylesheet_directory'); ?> found throughout the theme.
  10. <?php bloginfo('description'); ?> found throughout the theme. Your site's slogan.
  11. <?php bloginfo('comments_rss2_url'); ?> found in sidebar.php and footer.php.
  12. <!-- <?php echo get_num_queries(); ?> queries. <?php timer_stop(1); ?> seconds. --> found in footer.php. This HTML comment won't be overly useful to many of us, so delete away!
  13. If you are using widgets, you can also delete the code in sidebar.php between the lines<?php /* Widgetized sidebar, if you have the plugin installed. */
    if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar() ) : ?>

    and
    <?php endif; ?>
    Content between these 2 lines is only used if widgets are not enabled. If you know that you will continue to use widgets, then there is no need for any code here (It may be worth leaving a comment along the lines of "Content here used if widgets are disabled" to remind yourself of this in the future).

By removing these, you'll shave the load of your server and pages will be constructed that bit faster.

About the Author - Michael Martin is the founder of Pro Blog Design. He works as a freelance web designer, loves WordPress, and has an unhealthy addiction to smilies. Written on 8th October 2007.

Other posts tagged with , , , .

Comments

69 Comments

  1. thanks for the tips really helpful especially for those how use free web hosting, like me :D

  2. Good tips Michael. I just got done building a WP theme and stripped a lot of junk out. I didn't even think about replacing some of these functions with hardcoded ones.

  3. Thanks for these great tips. Anything that reduces the load on the server and the speed my website loads has got to be a good thing!

    However, I guess it's important to use caution when deleting stuff in case it effects function elsewhere on the site - having said that, just add it back in but keep a log of what you've removed :)

  4. This is a great post for all who use wordpress themes.

  5. Great post.......

    This is very helpful to bloggers ,who use free wordpress templates.

  6. Wow I never would have thought about removing those tags, I need to go search my template tonight and see if anything is there that shouldn't be. Another great post my friend.

  7. thanks for the great tips, actually i came searching from " how to delete wordpress tag" but landed up here, anyway great information.

    if you can come up with how to delete the tag on wordpress, i would greatly appreciated.

  8. Really informative and helpfull. Even small things do matter.

  9. Thanks alot...but i have a question that won't it affect the content of the page....????

    Isn't it important tags to run our theme correctly n perfectly ????

  10. gud info Thanks for sharing

    Atul’s Latest Post: Murphy’s Laws on Girls

  11. Nice post, but would have been more useful if you had mentioned what each tag's purpose is or linked to the relevant page on codex.

    Pallab’s Latest Post: Google vs Bing vs Yahoo : Find out Who is the best with Blind Search

  12. thx for those great tips. i replaced even more entries by using the really static expressions
    j4p4n´s last blog ..Umbauteil: Fußrasten

  13. wow... thanks a lot for this post, very helpful to my blog.

  14. Total score. I was looking for something totally different, but this will help my blog, it's so slow.
    Pam´s last blog ..How To Combat Boot Funk

  15. very useful post thanks
    Atul´s last blog ..Friendship Chain Award

Leave a Comment

Not sure how to get an image with your comment?

Link to your latest post? (If possible)