Possible way to Improve wordpress performance with wp-config.php 4 config variables

Tuesday, 6th March 2012

Wordpress improve performance wp-config.php logo chromium effect GIMP

Nowdays WordPress is ran by million of blogs and websites all around the net. I myself run wordpress for this blog in general wordpress behaves quite well in terms of performance. However as with time the visitors tend to increase, on frequently updated websites or blogs. As a consequence, the blog / website performance slowly starts to decrease as result of the MySQL server read / write operations creating I/O and CPU load overheads. Buying a new hardware and migrating the wordpress database is a possible solution, however for many small or middle size wordpress blogs en sites like mine this is not easy task. Getting a dedicated server or simply upgrading your home server hardware is expensive and time consuming process… In my efforts to maximize my hardware utilization and increase my blog decaying performance I've stumbled on the article Optimize WordPress performance with wp-config.php

According to the article there are 4 simple wp-config.php config directvies useful in decreasing a lot of queries to the MySQL server issued with each blog visitor.

define('WP_HOME','http://www.yourblog-or-siteurl.com');
define('WP_SITEURL','http://www.yourblog-or-siteurl.com');
define('TEMPLATEPATH', '/var/www/blog/wp-content/themes/default');
define('STYLESHEETPATH', '/var/www/blog/wp-content/themes/default');

1. WP_HOME and WP_SITEURL wp-config.php directvies

The WP_HOME and WP_SITEURL variables are used to hard-code the address of the wordpress blog or site url, so wordpress doesn't have to check everytime in the database on every user request to know it is own URL address.

2. TEMPLATEPATH and TEMPLATEPATH wp variables

This variables will surely improve performance to Wodpress blogs which doesn't implement caching. On wp install with enabled caching plugins like WordPress Super Cache, Hyper Cache or WordPress Db Cache is used, I don't know if this variables will have performance impact …

So far I have tested the vars on a couple of wordpress based installs with caching enabled and even on them it seems the pages load faster than before, but I cannot say this for sure as I did not check the site loading time in advance before hardcoding the vars.

Anyways even if the suggested variables couldn't make positive impact on performance, having the four variables in wp-config.php is a good practice for blogs or websites which are looking for extra clarity.
For multiple wordpress installations living on the same server, having defined the 4 vars in different wordpress seems like a good idea too.

Share this on:

Download PDFDownload PDF

Tags: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,

3 Responses to “Possible way to Improve wordpress performance with wp-config.php 4 config variables”

  1. hip0 says:
    Firefox 3.6.3 Firefox 3.6.3 Windows 7 Windows 7
    Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3

    Another good wordpress tip is changing the wordpress plugin URL:
    In wordpress this is done via a var WP_PLUGIN_URL:
    To change the default “wp-content/plugins” URL location for wordpress put the following line in: wp-config.php
    define(‘WP_PLUGIN_URL’, ‘http://www.yourwebsite.com/modules’);

    Doing so could prevent automated exploiting scripts to try to exploit wordpress, or simply can help hide that a blog / site is running wordpress.

    View CommentView Comment
  2. hip0 says:
    Firefox 3.6.3 Firefox 3.6.3 Windows 7 Windows 7
    Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3

    On some older 2.5+ < 3.0 wordpress installs setting:
    define('WP_SITEURL','www.yoursiteurl.com/'); could create redirect issues on login via http://yoursiteurl.com/wp-admin/

    If you encounter any issues with redirects after including the above 4 wordpress vars, comment define('WP_SITEURL'…); and you will be able to login again properly.

    View CommentView Comment
  3. Sven says:
    Google Chrome 31.0.1650.57 Google Chrome 31.0.1650.57 GNU/Linux x64 GNU/Linux x64
    Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.57 Safari/537.36

    Don't set the constant TEMPLATEPATH with define if you use a child-theme, otherwise the whole blog will only give a white page 😉

    View CommentView Comment

Leave a Reply

CommentLuv badge