13 Tags to Delete From your Theme
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.
- <?php language_attributes(); ?> found in header.php.
- <?php bloginfo('html_type'); ?> found in header.php.
- <?php bloginfo('charset'); ?> found in header.php.
- <?php bloginfo('name'); ?> found throughout the theme.
- <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.
- <?php bloginfo('stylesheet_url'); ?> found in header.php.
- <?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).
- <?php bloginfo('pingback_url'); ?> found in header.php.
- <?php bloginfo('stylesheet_directory'); ?> found throughout the theme.
- <?php bloginfo('description'); ?> found throughout the theme. Your site's slogan.
- <?php bloginfo('comments_rss2_url'); ?> found in sidebar.php and footer.php.
- <!-- <?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!
- 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.
Enjoy this post? Get future updates sent to you for free! Join by email or RSS.





8th October, 12:30 pm GMT
Cool tips. Thanks a lot!
8th October, 12:33 pm GMT
Either replace it with normal text or completely remove it!
I remove what I don't use. As for the rest, I keep them as it doesn't save that much server process anyway since servers are very powerful these days and single WP Template Tags won't hurt the server a bit.
8th October, 12:51 pm GMT
Doubt the average user even has to bother with this, as goldfries says servers can easily handle it. If your site gets more visitors then yes, these 13 extra php tags do add up. Let's say 5000 people browsing at any moment that's pretty much 65000 php statements additionally executed.
But in that case, do you keep something like wordpress needlessly php driven? Or do you simply display a cached version of it?
8th October, 12:52 pm GMT
Great insight into some of the tags. I especially recommend removing the WP version number from the site, as it does allow everyone to know what version you are using.
One additional thing to add to your site for security is a blank index.php file into the plugins folder. This prevents people from going to your plugin url and seeing what plugins you are using.
8th October, 1:22 pm GMT
Hehe. Usually those who know how to remove those 13 would add many more other plugins that use up equal or more resources.
For example, Recent posts, Recent comments, Top Commenters, Popular post, Receive E-mail notice, Highlight Author...........
The tags I usually remove are
wp_list_pages()
wp_get_archives()
wp_list_bookmarks()
and a few others in sidebar.php, I think bookmarks is the one for blogroll.
8th October, 1:25 pm GMT
Ehm, I don't agree totally with this article. There are better ways to decrease server loads than this, and it is just meddling with the templates.
First of all, when you'll get a newer version of the template, all that work will be lost, and also, if you want to make changes (the website name, for exemple), only html-savvy users will be able to dig where the information has to be changed.
I really think Wordpress put it that way for a reason. It must be easy for everyone to use.
8th October, 1:47 pm GMT
Some can be deleted like the WP version tag, but do you really recommend to delete the stylesheet tag?
The usual WordPress user won't know what to place where,
maybe an example/screenshot of your thoughts would help.
Unsavy Wp users will mess up with this, just take a look in technorati how many of them deleted the title tag.
8th October, 3:31 pm GMT
I was going to write a post on this. Beat me to it again.
Here's a (partially related) tip for WP users [about get_num_queries() ]:
get_num_queries() is a great tag. If you know what queries are, then I recommend you temporarily put the tag on your blog (in the footer), reload your blog and check the query count, then remove the tag. If you're blog seems slow after adding a new plugin, it could be querying the database a lot.
8th October, 4:13 pm GMT
removing the unncessary code in between the widget call is unnecessary. if the widget function exists, all that code is skipped by the PHP engine, so there's no load on the server from it. That said, when building my own themes, i usually just stick some dummy text in there (e.g., sidebar 1 goes here).
also, it should be more clear that the wordpress version code, unlike the rest should be DELETED, not replaced with static HTML. that little HTML comment about it being useful for stats, refers to Matt's statistics of how many users have wordpress installed, not to any stats on your own blog.
8th October, 4:15 pm GMT
I don't know what those php codes refer to, so I NEVER touched them. I always have the feelings that my blog will crash if I did anything unnecessarily to it.
Yeah, I'm a scaredy cat! LOL.
8th October, 8:01 pm GMT
You're right. These are typically static elements which won't change once you've established your site. It could be the difference between having a site that is up during a spike in hits and one that complains that there are too many SQL connections. Everything adds up. On certain sites I own where I have permalinks which get hit and linked to many times, I've converted the pages to 100% static html. This may seem like overkill, but it has saved me the cost of renting another server.
8th October, 11:27 pm GMT
This is very true, it'll cut down a lot of processing time. Great tips.
9th October, 2:42 am GMT
Slevi said - Let’s say 5000 people browsing at any moment that’s pretty much 65000 php statements additionally executed.
9th October, 11:16 am GMT
Keep in mind that on a scale of the entire internet seen John Chow's blog is nothing either eh ;). The 11.295 visitors a day which John Chow reaches isn't much at all, if you take a look at some of the major torrent trackers they reach about 800.000 unique visitors a day and about 4 million page views a day. And with 4 million a day you're doing about 50 a second, so 65 additional statements each second. You can understand that sites like those are fully cached :P.
Another great example is the Gaia Online forums, which has a record of over 100.000 people online within a period of 15 minutes, since it's a forum those people will probably view 3 pages at least making up for about 300 pageviews a second.
John Chow might believe he's a big boy, he might let many readers believe, but in reality the guy has nothing made yet to be really proud of. He falls into nothing compared to the real big sites on the net which make the hundreds of thousands of unique users each day ;).
9th October, 1:34 pm GMT
∞ Slevi, hehe, seems like you don't like J.Chow...
but you're on the right site, he IS a big booble.
9th October, 4:00 pm GMT
Kinda off-topic but anyways: It's not so much not liking John Chow since I dunno the guy, but I do think that he thinks too highly of himself at times or at least gives that impression.
Whilst in reality, now what all has he achieved? Something which many of us probably wouldn't say no against but in the meantime it's not like he jumps out or anything above the rest.
When it comes to subscribers he's far from the highest, if you're talking about monthly income his 20.000 he made last month falls into nothing compared to what the bigger sites are making online and if it comes to traffic there are sites which get within a day what he makes within 2 years.
So I just don't get why people keep bringing up a guy which essentially just blogs for making money into matters like this. Whenever something is about making money online or high amounts of traffic John Chow tends to get brought up even though he fades away compared to the real big guys out there.
Bit more related to the topic: John chow with his less than 10 visitors a minute wouldn't really have a need for optimization, taking it for granted that he hosts his site on a dedicated server rather than shared hosting. It should be able to cope with that, but some servers definitely do experience quite a little bit more stress and optimization in these forms definitely would be handy there.
But also for the average user it can be one of those things to prevent your host from kicking you off for that matter. You might perhaps not by yourself knock your server down, but keep in mind that you're most likely sharing the server with a load of other people. By reducing the php statements used on your site your effectively reducing the overall CPU load which the host undergoes, this in return means that you can keep on hosting on a shared hosting account longer before having to switch to a more expensive form of dedicated hosting.
9th October, 6:50 pm GMT
Thanks for wonderful tip Michael .
9th October, 11:47 pm GMT
goldfries and Slevi - Thanks for the comments guys, and I know that little tips like this aren't crucial for most users, but every little helps, and when you're trying to put off upgrading to that fancy hosting plan for as long as possible, you're going to appreciate all the help you can get.
Elliot - Good tip for the plugins. That directory is already forbidden on my server, but that may not be the same for everyone.
goldfries - lol - That's true, but I haven't yet found a cure for plugin addiction!
Nathalie - The benefits this sort of thing provides are pretty small, so a user that isn't confident with HTML would be perfectly fine not doing them, as you said.
But for many of us, editing the HTML is no problem (Considering how rarely it needs to be done). The tags are definitely best for out-of-the-box themes, but that doesn't mean that everyone should keep them that way.
milo - I know what you mean, and there's no real cure for that. However, I did recommend a pretty easy way of making the changes, and carrying out little tasks like this is one way of getting a little more confidence with HTML (Which all bloggers could use.
)
Redwall - Thanks for the tip. I used the tag the way you suggested when I set up this blog. (At the time I didn't think to uncomment it though. Woops.
)
Adam - I know that the code is skipped, but why bother having the code bloat at all if it's doing nothing? Thanks for the explanation of that stats comment though! That has always bugged me!
pelf - lol - Just like so many other bloggers! You're just right though. Some times it's just not worth the hassle when you aren't comfortable with what you're doing.
Ken - The SQL connections are the main reason I did this in the first place as well. At the minute I'm probably depending largely on WP-Cache to keep me up if I ever get Dugg, at least long enough to pull off the static HTML trick that you used as well. Anything is worthwhile if it keeps you up for all that traffic!
Deaf Musician - One has to hope!
Slevi and milo - I always love the discussions, but please don't bash another blogger. I imagine they'd be a little ticked to read it.
JC's isn't my favorite blog to read either, but considering how popular it is (for a blogger Slevi
), he must be doing something right, and you have to respect the confidence of it all.
Madhur - Glad you liked it.
10th October, 6:41 pm GMT
There are two things here, that I understand(correct me if I'm wrong) - PHP is infinitely more faster than MySQL, and the reason why queries should be reduced is because of that. Right?
But, isn't it better to use less plugins, optimize and minimize your theme more before doing these stuff? If you're preparing for a digg, good luck. I had this spirit of total optimization, and ended up stripping the theme of all images(except header) which caused a frown among regular visitors.
The fact is, normal traffic rarely needs theme optimization, and sites on shared hosting probably would not withstand diggs/other spikes even with reducing queries - its all down to MySQL and HTTP requests.
10th October, 9:29 pm GMT
Sumesh - One thing alone isn't going to save you from a Digg, as you said. But the combination of many small things could well make that difference.
I'm hosted with MediaTemple, and one of their offerings is 2 "bursts" per month. It means that they will up my MySQL resources to stay online during a Digg, so provided I can keep my server processing load low enough as well, then I shouldn't have any trouble.
It makes taking the few minutes for something like this all worthwhile.
11th October, 6:34 am GMT
LOL. I see a sudden J.Chow bashing here.
I'm not his fan either, I'm just using his blog as a comparison - not comparing the 'Who's bigger on the Web-O-Sphere'.
My point - tags aren't an issue if you consider the capability of servers + the amount of traffic in general.
The plug-ins added usually cause more load than the 13 tags removed anyway.
I don't disagree on the lesser load part, it's just that it's too minor for anyone to do so unless sparing server resource is really compulsory.
11th October, 10:09 pm GMT
Your call goldfries. I agree that it's not a massive change, but I'm definitely one of the "every little helps" crew, so something like this suits me.
14th October, 6:33 pm GMT
Excellent! My webhosting account CPU Load are going as high as 4.3% (max. 4.5%)...after using the tips here...my CPU Load is only about 3.2%
14th October, 7:30 pm GMT
Thanks for sharing your stats SeoTier. Good to see an example of this being effective.
25th October, 5:30 pm GMT
There!
I deleted those tags and now I'm actually seeing a better load time!
Thanks!
7th November, 1:12 pm GMT
I agree with Milo and Adam. Not really a good idea to remove all the PHP tags. Especially if you expect things to update and work as your site develops. Removing unused sidebar widget code is a good thing though.
+++--- Will Mac users ever realise that this size of Helvetica looks totally disgusting on IE and not particularly nice on firefox
7th March, 5:43 am GMT
Fast is better. This is good advice for sure. A lot of the bloat on some of the sites is even pressing broadband, like Flash heavy sites and stuff. It is mind blowing how many people are still on phone modems, I guess broadbanders take that for granted sometimes. I forgot what the percentage estimated was, like 50% or something.
8th May, 8:52 pm GMT
My site loads a lot faster now that I've done the tweaks you outlined here. Thanks, Michael!
10th May, 1:20 am GMT
No problem. Glad it worked well for ya Rob.
11th June, 9:05 pm GMT
Michael, did you do any benchmarks? If you remove those tags in the best case you will win a couple of queries - this will be approximately from thousandth to hundredth fractions of a second.
Wouldn't it be better to use a cache (plugin) like Hyper Cache or Super Cache or something like this? In my opinion, performance improvements will then be noticeable.
11th June, 9:16 pm GMT
Update: I have looked through the list of all SQL queries executed, it seems that tags removal does not eliminate any of them
Probably need another type of optimization...
25th June, 5:54 pm GMT
Informazioni davvero utili, per molti siti in WordPress sono davvero indispensabili.. Confido molto nell'utilizzo di questi suggerimenti.. Grazie. Good Tip. Thanks
19th July, 10:02 pm GMT
Very good tip. Will try doing it for my blog...
20th July, 5:25 pm GMT
Great tips and conversation. What about speed optimization for those of us that would rather pay a Pro? Anyone recommend someone that specializes in WordPress and actually knows what they're doing? SEO optimization and security issues would be a huge plus too.
I'm not talking about a complete $800 blog design, just tweaking and improving on the theme already being used.
20th July, 5:40 pm GMT
Can recommend myself
I'm modest, I know
I specialize in security and MySQL optimization/server tuning.
Is the blog speed really the issue for you? As far as I can tell, it loads rather fast (the home page is almost 1 Meg in size and needs more than 400 requests, which is overkill, although WP gives the content away very fast).
30th July, 7:12 am GMT
Great post. I have removed lot of tags that are mentioned in this post. Hope it helps to decrease some server load...
4th August, 2:10 pm GMT
thanks for the tip!