Tips To Speed-Up Your WordPress Blog Loading With Minimizing SQL Query

Number of View : 5941

tips to speed-up your wordpress blog loading with minimizing SQL queryHello there, now mistertips willl be sharing how to speed up wordpress blog loading with a minimizing request the query to the database. As we know wordpress is a blog engine built with PHP and a MySQL Databases. So, every time the blog is accessible, there will be demand queries to the database first before a post or otherwise displayed to the reader. More and more requests to a database query will be take a longer time for required loading.

In order to be faster loading blog, then we must minimize the request query to the database (making it static within a certain time in the form of cache), how can use DB plugin Cache Reloaded, W3 Total Cache, WP Widget Cache or the other.

Although it may already exist that use the plugin, we can still optimize it again. As we know in fact there are some queries that we can cut the request or make it static forever (as needed), such as the blog name and tagline or description of the blog, carshet Content-Type blog, language_attributes, url blog feeds, XML-RPC url, url css files , javascript and others which in the file header.php in the theme folder. Mistertips will give an example, blog name and tagline for the code to be written like this (not exactly the same depending on the type of theme) :

<h1 id=”title”><a href=”<?php bloginfo(‘url’); ?>/”><?php bloginfo(‘name’); ?></a></h1>

<div id=”tagline”><?php bloginfo(‘description’); ?></div>

That code are usually placed in the file header.php in the theme folder or file header.php in the template folder (such as theme inove), instead there is another theme which is placed in file functions.php, basically looking for the H1 tag is usually used for blog title and description / tagline. Tags we could create a static instance, so it would be like this:

<h1 id=”title”><a href=”http://YourDomain.com”/>Your Blog Name</a></h1>

<div id=”tagline”>Description/Tagline Blog Anda</div>

Customize with your blog url, blog name and description of your blog.

For language_attributes, carshet Content-Type, the blog feed url, XML-RPC url, file css url, javascript and other code are usually written like this (dynamic) :

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>

<html xmlns=”http://www.w3.org/1999/xhtml” <?php language_attributes(‘xhtml’); ?>>

<head profile=”http://gmpg.org/xfn/11″>

<meta http-equiv=”Content-Type” content=”<?php bloginfo(‘html_type’); ?>; charset=<?php bloginfo(‘charset’); ?>” />

<link rel=”alternate” type=”application/rss+xml” title=”<?php _e(‘RSS 2.0 – all posts’); ?>” href=”<?php bloginfo( ‘rss2_url’ ); ?>” />

<link rel=”alternate” type=”application/rss+xml” title=”<?php _e(‘RSS 2.0 – all comments’); ?>” href=”<?php bloginfo(‘comments_rss2_url’); ?>” />

<link rel=”pingback” href=”<?php bloginfo(‘pingback_url’); ?>” />

<style type=”text/css” media=”screen”>@import url( <?php bloginfo(‘stylesheet_url’); ?> );</style>

or

<link rel=”stylesheet” href=”<?php bloginfo(‘stylesheet_directory’); ?>/stye.css” type=”text/css” media=”screen” />

<script type=”text/javascript” src=”<?php bloginfo(‘template_url’); ?>/javascript.js”></script>

Created static becomes like below (do not forget to backup before the original code or all of the files intact in case there is a typing error) or can be tried on the local server:

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>

<html xmlns=”http://www.w3.org/1999/xhtml” dir=”ltr” lang=”en-US” xml:lang=”en-US”>

<head profile=”http://gmpg.org/xfn/11″>

<meta http-equiv=”Content-Type” content=”text/html; charset=UTF-8″ />

<link rel=”alternate” type=”application/rss+xml” title=”RSS 2.0 – all posts” href=”http://YourDomain.com/feed” />

<link rel=”alternate” type=”application/rss+xml” title=”RSS 2.0 – all comments” href=”http://YourDomain.com/comments/feed” />

<link rel=”pingback” href=”http://YourDomain.com/xmlrpc.php” /> <style type=”text/css” media=”screen”>@import url( http://YourDomain.com/wp-content/themes/YourThemesDirectory/style.css);</style>

or

<link rel=”stylesheet” href=”http://YourDomain.com/wp-content/themes/YourThemesDirectory/style.css” type=”text/css” media=”screen” />

<script type=”text/javascript” src=”http://YourDomain.com/wp-content/themes/YourThemesDirectory/YourJavaScriptName.js”></script>

The code can be checked by looking at the source code for each blog, so just adjusted it. To feed’s url can also be directly replaced with your feedburner url. With this method mistertips can reduce / cut the request to a database query is more or less there are 15 queries, including queries that come from the plugin.

 

If you liked these wordpress tips, please help mistertips to spread this website.

Related Post :

3 Comments to "Tips To Speed-Up Your WordPress Blog Loading With Minimizing SQL Query"

  1. December 27, 2011 - 1:09 pm | Permalink

    Thanks artikelnya gan…
    salam kaskus..
    Ijin ninggalin jejak…. :D

  2. January 16, 2012 - 1:23 am | Permalink

    Satu lagi cara pake plugin wp minify gan….
    Dijamin menaikan kecepatan juga…..

Leave a Reply