Site5 - Built For Designers & Developers MENU
Home  ›  Scripts/Software  ›  WordPress  ›  WordPress: How To Increase Speed Through Optimization

WordPress: How To Increase Speed Through Optimization

13 Comments

Have you run into an issue where your WordPress site is running slow or you’re seeing spikes in your resource usage that you want to get down? Look no further! This checklist will help you optimize your WordPress site, speed up its response time, and lower your resource usage at the same time!

Special thanks to Penny Butler for giving us permission to post this content!

Backup Tip: If you have a caching plugin, which you most likely do, remove the cache-files from your backup program. This will make your backup size much smaller and less-likely to have problems and it’ll also speed up the backup and restore times due to the smaller backup size.
  • Update any out-of-date plugins, themes, or WordPress itself if required.
  • Run TimThumb scanner and ensure everything is up to date and all vulnerabilities are patched.
  • Replace Google Analyticator with Google Analytics for WordPress and reconfigure the plugin with the settings you were using in Google Analyticator.
  • Use WP Cleanup to delete:
    • Revision Posts
    • Draft Posts
    • Auto Draft Posts
    • Spam Comments
    • Orphan CommentMeta
    • Orphan PostMeta
    • Orphan Relationships
    • Dashboard Transient Feed
  • Use WP Cleanup to optimize your database.
  • Run Broken Link Checker once and fix or delete any broken links, once that is complete, disable and delete the plugin.
  • Setup WP Firewall 2 to “whitelist” your IP as well as the IP address of the server and configure the settings.
Note: everything should be “checked” except “Block leading http:// and https://” and select “redirect to homepage” instead of showing a potential hacker an error message.
  • WP Crontrol
    • Check WP Crontrol for any cron jobs that are running from plugins that you have uninstalled. If there are any, make sure to delete them.
    • Check WP Crontrol for any cron jobs that are running too often (more frequent than every 15 minutes). If there are any, adjust them accordingly.
  • Disable the WordPress cron and replace it with manual cronjobs:
    • Disable the cron in wp-config.php by adding this line:
define(‘DISABLE_WP_CRON’, true);
    • Configure WP-Cron Control and setup the manual cronjob from within cPanel/SiteAdmin.
  • Configure Plugin Organizer so that the plugins that use the most amount of resources are only used on posts/pages that you specify. Also use Plugin Organizer to re-arrange the plugin load-order, and to disable plugins that are not needed in the backend, or front-end. This will essentially lower your resource usage by only having things enabled where they need to be enabled.
  • Run Clean Options and delete tables from the options table (always be careful to delete only those tables of plugins that you know for a fact that you have uninstalled).
  • Run your images through the “bulk optimize” feature of EWWW Image Optimizer.
  • Ensure Akismet is installed and setup. If it is, clear any spam/stats out.
  • Turn off any “automatic” backups if any are setup. These could be the cause of the spike and you can check your logs against the date of last backup to find out.
  • Do a Google PageSpeed test to get hints on what else to optimize, such as:
    • Installing and configuring W3 Total Cache
    • Setting up a CDN (either on a sub-domain or using Amazon S3)
    • Minifying javascript & css files
    • Manually optimizing images that EWWW couldn’t access (like theme images, and any images that were not uploaded via the Media Library)
    • Manually re-sizing images to exact dimensions that have been re-sized dynamically by a plugin/theme.
    • Find out which Javascript & CSS files are large. This will help you decide whether it’s worth having that plugin/theme/widget or replace it with something less resource-heavy, or throttle it by disabling it in Plugin Organizer and only enabling that plugin on posts that need it, etc. (especially worth doing for Facebook, Twitter, and other Social Media related plugins)
    • Convert individual, repeating images into a single sprite image.
  • Delete any unnecessary log files from the WordPress backend. These would be logs such as Akismet logs, Link-Tracking logs, or any other plugin’s logs that you don’t normally need or look at.
  • Install Exploit Scanner once to test for exploits, then disable and delete it after the scan has been completed. (Usually you would only do this if you suspect site has been compromised, otherwise skip this step).
  • Configure Login Lockout and set the lockout length high and the retries low, and redirect them to homepage instead of letting them know they got the wrong username/password.
  • Go to cPanel > phpMyAdmin and do a manual repair & optimize of the database (back up your database first if you’ve never done this before). While you are there, check out the database, look for anything that shouldn’t be there or the file sizes of certain tables (does it look right or does something look abnormal). Note down anything that needs further investigation, and make sure to back up the database before doing anything in here.

All of the above steps should be covered completely every time you find out that your site is using a high level of resources or is just running slow in general. Then, the next thing to do would be to start digging to find the actual cause of the problems.

  • Install P3 Plugin Profiler to see what plugins are using the most resources and see if there are any that are using a large amount of resources that you can remove or exchange for a more lightweight or better-coded plugin.
  • Check 404 errors and see if there is anything odd in there that you need to investigate (such as, thousands of visits to a specific page that doesn’t exist, visits to admin-like pages, visits to known exploits).
    • If they are pointing to a file that doesn’t exist that should, it should be fixed.
    • If they are pointing to a file that doesn’t exist and never existed and you have no idea what it could be but it looks suspicious, you should add a 301 redirect to send them some place else.
    • If they are pointing to admin-like pages, ensure you secure your site and find their IP and block them.
    • If they are pointing to known exploits (timthumb, etc.), ensure your plugins are up-to-date, do your research on that particular exploit (google it) and see what you can do to prevent them from getting in.
  • Check your AWstats from cPanel and see what IP addresses are the “Top” Visitors and “Top” Robots/Spiders.
    • Block any suspicious IP addresses (do an ip-lookup on them or even better, search for their IP on Project Honeypot). You can use either:
      • SpyderSpanker (this will also do the Honeypot lookup for you and automatically block bad guys)
      • Directly within your cPanel/SiteAdmin > IP Deny Manager
      • You can “try” to block them in your robots.txt file but that’s usually useless as ‘bad bots’ ignore it
      • You can block IP addresses directly within your .htaccess file
  • Turn on the RAW access logs archiving (cPanel/SiteAdmin > Raw Access Logs > Archive every 24 hours).
  • Then download the Raw Access logs and see if there are any clues as to why your site is using too many resources (it might show a lot of cron jobs, or point to which files are being accessed the most which will clue you in on where to focus your energies).
  • Check your cPanel/SiteAdmin error logs from your server and from cPanel/SiteAdmin > File Manager. The error logs in specific directories can also help find the cause:
    • ./wp-admin/error_log will help you find any internal wordpress related errors
    • ./wp-content/themes/your-theme-name/error_log will help you find any theme-related errors
    • ./public_html/error_log is the main error log , etc.
  • Check for any changed error logs in FileManager (sort by date to see when they were last modified) to find any clues ( PhP warnings, database errors, etc.).

If you’ve tried everything above, and you’re still at a loss as to what is causing the spikes in resource usage or your site is still running slow, you can try these final checks to make sure there is nothing else that could be causing problems on your site.

  • Change opt-in boxes to a third-party like Aweber/Mailchimp, etc. instead of using the default autoresponder or plugin from your cPanel/SiteAdmin panel.
  • Do you have any large images on your pages/posts? Even if they are located on your server and not on posts/pages, Google Images and people can still ‘find’ them and download them/view them which uses server resources. You can use cPanel/SiteAdmin > File Manager or an FTP program to view files on your account and sort by “size”. Then, look at the larger files to see if there are any that are needed, maybe you will still need them, in which case you can re-size them and optimize them with RIOT image optimizer.
  • Make your site W3c compliant.
  • Remove any social media icons that are not needed/used.
  • Host your mail elsewhere (Google Apps/Gmail) instead of using your account on the server. (your email counts in the resource usage).
  • Remove any widgets on your site that are not necessary (Consider de-activating footer widgets altogether).
  • Ensure media like videos and mp3′s are hosted elsewhere (like YouTube).
  • Change the amount of posts that are shown on the category/archive pages if you can. You might have it set to 10-20, you can change it down to 4-8 depending on what would be suitable for your site/audience.
  • Replace any external images with internal images if possible (some plugins make this impossible).
  • Do you have a slider on the homepage? Consider removing some images/videos from the slider to lighten the load on your homepage.
  • If server resources are still being used and you’ve tried everything above, then consider optimizing your site with CloudFlare which helps block malicious traffic if it exists.
  • Do you have any big files on your account? Things you’ve offered to others to download, etc.? If so, consider moving those files to Amazon S3 or a file-sharing website instead of having them download it directly from your site.
  • Using cPanel/SiteAdmin > File Manager, you can check for any directories that may no longer be needed (You would’ve put them there to begin with, but do you still use them? Was it an old facebook page? Was it something you were testing? Did you install something that you no longer use? Old caching plugin data? Old Plugin files? Old database backups, etc. (be careful with this one, you don’t want to delete something you forgot you actually needed).

And, if you’ve made it this far, your site is now probably running much faster and most likely using much less resources, congratulations! If you run into any problems performing any of these steps, feel free to contact support through your Backstage panel and we’ll be glad to help out!

Special thanks to Penny Butler at http://pennybutler.com/ for giving us permission to republish her original article!

Still have a question? Or need help?
If you need technical support with your account, please email us or chat live with a representative.

13 Comments

  • If you need a real cron, but you host doesn’t provide it, you can consider using a wordpress plugin: http://www.wordpress.org/plugins/easycron/

    • Hi Kake,

      That plugin will work, yes, but will simply add a plugin when it is not needed. Every plugin adds to the resource usage your site has, and a cron plugin is not really necessary with most hosts, as the ability to create crons is pretty common.

  • Any clues as to why Google Analytics for WordPress is a better option than Analyticator? We make Analyticator and I’m eager to learn what we could do better.

    Keep up the great work.

    • Hi Troy,

      To be honest, I have never used Analyticator, so I am unsure about that. I will certainly take a look, though, and see how it works :)

    • Hiya Troy,

      The reason I suggested that was because Google Analyticator has a really cool backend dashboard (love it!) …but.. that really cool dashboard unfortunately uses resources. When you are trying to make your shared-host happy & trying to cleanup unnecessary system resources.. using an Analytics plugin that doesn’t have a cool dashboard will save some resources. The reason I switched to ‘Google Analytics for WordPress’ is just because it was lightweight and also because it was created by Joost de Valk (the guy from Yoast.com). Probably a better suggestion would be to add the code manually rather than use a plugin, but I’m a plugin junkie and switch themes all the time, so using a plugin for me is more convenient.

      I don’t presume to know everything, I’m ever-learning. I originally created this list because I was having my own problems over & over again.. and these were the list of things I tried. So if you (or anyone else) have better suggestions to add to the list, please share them with everyone, because you probably know more than me… this was just the way that ended up working for me when my sites were constantly spiking out-of-control & I just wanted the nightmare to end :)

      Kind Regards,
      Penny

  • Would adding any of these plugins slow the site as well?

    • Every plugin will add to some resource usage, and cause extra code to be run which can slow things down. The benefits you get from these, however, outweigh the minimal impact these will have.

      • Will it not be better if Site5 had resource meters (CPU/RAM) like Hostgator does for example? I like your company and system more but that is one thing that I liked that I now miss.

        Cant really optimise without some indication of the resources being used. Its like trying to paint in the dark.

        The plugins that show what other plugins are using are good but not all resource usage is from plugins of course.

        • Hi Gary,

          We monitor these together, under Resource Points. You can access this in your SiteAdmin under Resource Usage.

  • If I were to add the following to the wp-config.php file:
    define(‘DISABLE_WP_CRON’, true);

    what command line for the cronjob in cPanel would I need to use?

    “wget -q -O – http://example.com/wp-cron.php?doing_wp_cron” ?

  • Hi, i hope this is the right place to ask this, I need a few suggestions. my blog is currently on a free hosted platform and its getting a huge traffic so am thinking of moving it to a VPS. i was recommended by a friend to get the VPS2 by site5 but my question is. Can it handle 200k hits a day? and are there any hidden charges?

    you can also email me the full details if you don’t mind

    • Hello Zack,

      There are no hidden charges, no. There are other factors to consider for the VPS level, though, and I would recommend you contact our support team for a full recommendation.

Money Back Guarantees