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

If your server is not using PHP 7 (or more) yet, ask for it. It will improve the performance drastically. WordPress will also soon require it.

Restrict the number of 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 but using external services for optimization and caching. Please check my articles about Images Optimization and CDN. Also, it’s better to have security handled by your hosting service (and Cloudflare). Security plugins slow down your installs and open their own share of security holes.

Use the minimum number of plugins possible. 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.

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 a plugin for that, but it’s not really needed, as it’s really simple. There is a nice article about all this here, and most of the content be below comes from it. Here it is.

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’ 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.