Reduce Database Calls Like A Pro


Note: This step is a little more technical and will need basic knowledge of PHP and WordPress template files.
Unfortunately, there are a lot of poorly coded WordPress themes out there. They ignore WordPress standard practices and end up making direct database calls, or too a lot of unnecessary requests to the database. This can really slow down your server by giving it too much work to do.
Even well-coded themes can have code that makes database calls just to get your blog’s basic information.
In this example, each time you see <?php, that’s the start of a new database call:
1
2
3
4
<html xmlns="http://www.w3.org/1999/xhtml" dir="<?php language_attributes(); ?>">
<head profile="http://gmpg.org/xfn/11">
<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>
charset=<?php bloginfo('charset'); ?>" />
You can’t blame theme developers for that. They simply have no additional way to find out what language your site is in.
But if you are customizing your site use a child theme, then you can replace these database calls with your specific information in order to reduce all those database calls.
1
2
3
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr">
<head profile="http://gmpg.org/xfn/11">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
analysis your parent theme for instances like this that can be easily replaced with static information.


Post a Comment

0 Comments