How to: Make WordPress Faster & Optimize It

Basic Recommendations

Excellent Hosting Service

This is probably the most important: you need a proper hosting service. You might be happy spending only 2$ or 5$ per month for it, however, do you need to spend many hours every month on backups (or even paying for it), making it faster, and fixing issues after a crashes or hacks? If you value your own time more, then it’s probably better to spend a bit more on your hosting service. Last but not least, avoid using a VPS if you don’t have an engineer helping you optimizing it. They are not optimized by default.

Here are my recommendations: the Best Hosting Services for WordPress.

Recent version of PHP (at least, 7.3)

If your server is not using PHP 7 (or more) yet, ask for it. It will improve the performance drastically. WordPress already requires it! Ideally, go for PHP 8.

Limit the number of installed plugins

The plugins installed on your WordPress have a huge performance impact. It is by far what slows down your website the most.

Even the plugins supposed to make your WordPress faster might make it slower. The best examples are caching plugins, optimization plugins and others. They indeed might accelerate the browsing of your website through caching, but they will slow down your install, especially the experience you have when you are logged in.

Move whatever process you can out of your WordPress. I am not talking about moving your images here. I am talking about using external services for general optimization and caching. Security plugins also slow down your installs and open their own share of security holes. It’s much better to have security handled by your hosting service and/or Cloudflare. Don’t use plugins for all this.

If you are using a plugin for a tiny feature they have, try to either live without that plugin at all, or ask a developer to help you to add that feature to your site, without the need of a specific plugin.

Use the minimum number of plugins possible. For a content-only website, it should be less than 12-15. For a store, or an advanced site on which many users and visitors can logged-in, 25-30 might be acceptable (of course, that depends on the weight of those plugins). If a plugin has many options and features, avoid it. Use a light plugin which only does what you need. If it doesn’t exist, do you actually need that feature? Sometimes less is better. And faster, in this case 🙂

The Empty Request Time

This term doesn’t exist, Meow Apps made it up! 🙂 But basically, each time you load your website, the WordPress admin, or run a request to perform an action (asynchronously or not), the whole WordPress framework will be loaded. Along with it, all the active plugins will be loaded as well and those might run processes (such as updating the database, running tasks, etc). And finally, after all this, your request will be considered and performed (even if it is just to display a Hello World page). Scary, right?

Therefore, listing the posts in your WordPress will take the Empty Request Time (this scary process explained above) + the time it takes to list the posts and to organize them on a page.

Your goal is to limit this time to the minimum. If it is more than 2,000 ms, that will cause issues (you will get timeouts very often). Ideally, it should be less than 500 ms.

If you install any plugin from Meow Apps, visit the Dashboard under the Meow Apps menu and you will find the screen below. It runs automatically every 5 seconds and calculate the average as it goes.

Empty Request Time

This idea would be to let this run, check your score, disable one plugin, click Reset and wait for your new score. By doing this, you might find which plugins (or options) are slowing down your WordPress.

Clean WordPress Database

Before cleaning your WordPress, make sure you have a backup for it. I recommend you BlogVault if you don’t have any yet.

Optimizing the database is very straightforward, it’s done by deleting the revisions, the drafts, and all that. You can use Database Cleaner for this, but if you enjoy running your own SQL requests, here are some for you, and they will help!

Delete all the revisions with this SQL request:

DELETE a,b,c  
FROM wp_posts a  
LEFT JOIN wp_term_relationships b ON (a.ID = b.object_id)  
LEFT JOIN wp_postmeta c ON (a.ID = c.post_id)  
WHERE a.post_type = 'revision';

Delete the auto-drafts:

DELETE FROM wp_posts WHERE post_status = 'auto-draft';

Optimize the WordPress tables:

OPTIMIZE TABLE `wp_commentmeta`, `wp_comments`, `wp_links`, `wp_options`, `wp_postmeta`, `wp_posts`, `wp_terms`, `wp_term_relationships`, `wp_term_tax

Disable the revisions and the auto-drafts by adding the following lines in the wp-config.php (not necessary):

define('WP_POST_REVISIONS', false );
define('AUTOSAVE_INTERVAL', 259200 );

Clean WordPress Media Library and Files

You can use Media Cleaner to remove all the useless Media entries you have. Even the free version does this! If you use the Filesystem method, you will clean even more useless files.