WordPress: How To Increase Speed Through Optimization

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!

Posted in