How to speed up WordPress blog with wp-config.php tweaks?

HostMonster and Bluehost list out all the slow SQL queries that use more than 1 second query_time in $HOME/tmp/mysql_slow_queries folder. I guess they have poor performance DB server because the other 2 web hosting that I use ~ HostGator and Just Host don’t have it. Anyway, if you see lot of log files there, this mean that you are using quite some CPU resources and getting sooner to get suspended like I did. When you look into these logs, you will find most of them are WordPress standard SQL queries and you can’t do any optimization on the queries themselves. But there are other ways to reduce access to DB server like wp-config.php tweaks.

How to speed up WordPress blog with wp-config.php tweaks?

By adding WP_HOME and WP_SITERUL, WordPress does not need to access to DB server to grab these 2 values every time when header or footer call these for RSS, CSS, JavaScript location on your theme.

define(‘WP_HOME’, ‘http://spblogger.com’);
define(‘WP_SITEURL’, ‘http://spblogger.com’);

WordPress Security Keys. Have it pre-defined in wp-config.php to eliminate WordPress to generate there salts for you if none are provided. Get yours here.

define(‘AUTH_KEY’, ‘xxx’);
define(‘SECURE_AUTH_KEY’, ‘xxx’);
define(‘LOGGED_IN_KEY’, ‘xxx’);
define(‘NONCE_KEY’, ‘xxx’);

Disable post revision function. This will reduce number of rows in WordPress post table == faster page finding and loading. I don’t use it anyway, so I disabled it.

define(‘WP_POST_REVISIONS’, false);

Be sure to check out AllGure.NET post for more info.

  • Yeah, this will reduce the load on db. I did some hard coding on the “path” in the theme file as well making page load faster 😀

    • Tried to do it too but failed. What is the ‘full-path-to-wordpress-root’? 😛

  • Ohhh. That one ah. If not mistaken is the path you install your wordpress e.g /home/ah-hong/

    • Yeah, I got it already. Thanks. 🙂

  • met

    Hey if we define the variables that you mention will wordpress use them as automatically?

    Do we need to make some changes on theme ?

    • Yes, it should be. No changes needed in theme.