Freshly Pressed

Web hosting with an emphasis on SUPPORT. Now there's a novel idea…

Minimize PHP and Database Queries

Why?

Because each time a page on your site loads, if your browser has to execute any PHP queries, it adds to the load time. So, the obvious thing to do to reuce this waste of time is to replace the PHP queries with static HTML. That way, every time a page loads, your browser just reads the HTML instead of having to contact the database.

I have found myself thinking quite a lot about this recently, with making a new theme. Because a theme is for multiple users, you have no choice but to make it do a lot of queries, but if you are happy with your chosen theme, why not take a minute to look through and see what changes you can make.

Here is a typical example:

Often in the header of a theme you will see the following or similar:

<?php bloginfo('name'); ?>

This will mean the site, when loading, will do a database query to find the domain name. To stop this from happening, you simply need to enter the domain name yourself and remove the query. Of course, if you only have a couple you will not notice much in terms of gained speed on your site, but if there are many – and that is more often than not, the case with many themes – then making these changes will make a significant difference.

Related Posts:

No related posts found!

Leave a Reply

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>

OFFER ONE

All you need to do is purchase a full year subscription and you receive TWO months FREE!

OFFER TWO

Refer a friend who purchases a full year subscription and receive TWO months FREE!

OFFER THREE

Add a referral link [with a small graphic] to your site and receive TWO months FREE!