General WordPress optimization techniques

 

Overview

The following describes some of the best potential solutions to address issues that commonly lead to slow or inefficient WordPress websites.

If you find yourself in a situation that requires changes to your site, and your developer isn't available to help, DreamHost's skilled support team may be able to assist you for a small fee. You can find more information about supported services and associated costs in the DreamHost Professional Services article.

Caching

Using a caching plugin

Caching creates static versions of your site, which means a lot less has to be processed by the server when a customer visits your site. This allows your site to load a bit faster, and also helps manage larger amounts of traffic. There are a few ways to set up caching for WordPress with plugins, which are described on the following page:

PHP Cache (OPcache)

OPcache is a caching engine built into PHP, which provides significant website speed improvements automatically.

OPcache is enabled by default on Shared, DreamPress, and VPS hosting plans, so if you're already using one of those plans, you do not need to enable it.

If you are on a Dedicated or DreamCompute Hosting plan, follow the instructions in the following article to enable it manually.

How to Optimize your database

Using the WP-DBManager plugin

You should routinely optimize your MySQL database to avoid a "fragmentation" effect. The easiest way to do this is to use the WP-DBManager plugin, which includes a function to optimize your database as well as the ability to schedule this optimization to run at a desired time (recommended once per month at least). To use the plugin:

  1. Log into your WordPress site's panel.
  2. Click 'Database' in the left pane.
  3. Click 'Optimize DB' under 'Database'. 
  4. Click the Optimize button on the page that appears.

Using wp-cli

View the following article for instructions on using wp-cli to optimize your database:

Using SSH to optimize your database

See the following article for details on how to optimize the database via SSH:

Optimizing via phpMyAdmin

See the following article for details on how to optimize the database via phpMyAdmin:

Optimizing your plugins

View the following article for information on how to manage your plugins:

Checking your theme

Using the optimal theme can be a challenge. While the available themes on wordpress.org are free and safe to use, some are better than others. When shopping for a theme, be sure to search Google to determine if any users have complained about site speed with that theme. These results can greatly help you determine which theme is best for you.

A quick way to check if your theme is causing issues with your site is to revert back to the default theme (such as Twenty Twenty-Four) and see if that resolves any issues with your site.

To change the default theme:

  1. Log into your WordPress site's panel.
  2. On the left pane, click 'Appearance > Themes'.
  3. Search for the default 'Twenty Twenty-Four' theme, and then click the Activate button.

Your site changes its appearance to the Twenty Twenty-Four theme. Use the online tools above to check if this improves your site's performance.

Determining which pages receive the most visitors

Every DreamHost website stores access.log information about the site. These logs can become very large and difficult to read, so there are a few commands you can run to quickly tell which site is receiving the most traffic. See the following article for further information:

Upgrading to DreamPress or a VPS

If you've tested the various plugins and suggestions as described in this article and still seeing a high load on the server, then it could be that the traffic to your site has outgrown Shared Hosting. If this is the case, you can consider adding a VPS or DreamPress to your hosting package.

If you have any questions about adding DreamPress or a VPS to your account, please contact DreamHost support for more info.

Checking for missing files in your WordPress installation

Your WordPress installation may be missing certain key files. This can result in 404 errors and can cause a server to work harder than normal as it tries to find them. This results in considerably slower load times, especially on popular websites.

One of the most common missing files is the favicon (favicon.ico) file. DreamHost automatically generates a blank favicon for all domains by default, but if you notice it's missing, you can easily create a new one.

Adding a favicon if one doesn't already exist is simple to do. You can add one using an FTP client, or by logging into your server via SSH. Once logged in, create a blank file in the root of your website's directory. This example assumes it's in the /home/username/example.com directory.

If you're creating it via SSH, run the following commands after logging in. Make sure to change username to your Shell user.

[server]$ cd /home/username/example.com
[server]$ touch favicon.ico

This command creates a blank favicon.ico file. A blank icon is far better than one that is missing since your server will not work harder looking for it.

To check for any other missing files, you can run your site through Pingdom Tools. A single pass through the site shows you any missing files that can cause your site to load slowly. Simply look for filenames in red and then either replace them or remove references to them in your themes or posts.

Checking other common issues for poor performance

There are many more reasons why a site may run slower than you expect. See the following article for further information on how to troubleshoot other issues such as CSS, JavaScript, and other internet issues:

Using online tools

Site load analysis tools

There are various online tools you can use to analyze your website. Such tools can provide insight into how your website is performing, identify issues that are causing your site to load slower than expected, and some tools even recommend solutions to help you troubleshoot further.

View the following article for a list of tools you can use to troubleshoot your site:

Browser tools

The following are a few recommended browser tools to help you troubleshoot performance issues with your WordPress site:

  • Firebug — A very handy tool that displays what is loading and how long it takes.
  • YSlow — A companion to Firebug that can provide some pointers on what to fix and how.
  • Web Inspector — Built into Chrome and Safari, it provides much of the same information as Firebug.

If you're running WordPress on a VPS or Dedicated Server

You can use the following tool to check your VPS or Dedicated Server:

  • Load Impact — A load testing service that hits your server with many simultaneous users. The free version provides a 50-user test. Be sure that you have caching enabled before running it. During this process, you can watch the CPU load with top, and RAM levels with free -m, or both with vmstat 1 (Ctrl-C to stop).

See also

Did this article answer your questions?

Article last updated PST.

Still not finding what you're looking for?