Speed Up Your WordPress Site with These Tips

Reading time: 4 minutes

Speed up your WordPress site with these tricks: improve speed and offer a smoother user experience.

Over time, your WordPress site may become slower. This happens because every plugin or theme you install leaves traces in the database, even after being removed. Unused options, forgotten tables, and automatically loaded settings can weigh down your system, increasing load times and slowing down the admin area.

Let see how to optimize your WordPress database by tweaking wp_options, reducing the number of autoloaded options, and manually removing obsolete ones via phpMyAdmin. Additionally, I’ll guide you through identifying and deleting unused tables, freeing up valuable space and improving site performance.

If you want a faster and more responsive WordPress site, follow these steps, and you’ll notice the difference!

Use the Query Monitor Plugin to Identify Slow Queries

Query Monitor is a fantastic plugin that, once activated, enables debugging for database queries, PHP errors, hooks and actions, HTTP API calls, and much more.

Simply reload the page, and in the top admin bar, you will see performance data and relevant information.

I specifically analyzed the slowest queries, and the following one immediately caught my attention:

SELECT option_name, option_value
FROM wp_options
WHERE autoload IN ( 'yes', 'on', 'auto-on', 'auto' )	
wp_load_alloptions()
Core di WordPress	rows affected 1315	time 0,8

This query loads all autoloaded options from the wp_options table. If there are too many options set to autoload, the site may experience significant slowdowns.
To check the total number of autoloaded options, connect to your WordPress database via phpMyAdmin and run the following query:

SELECT COUNT(*) FROM wp_options WHERE autoload = 'yes';

If the count exceeds 500, it means you have too many autoloaded options.

With the following query, I identified the largest options (adjust the limit as needed):

SELECT option_name, LENGTH(option_value) AS size 
FROM wp_options 
WHERE autoload = 'yes' 
ORDER BY size DESC 
LIMIT 20;

If an option does not need to be loaded on every page, you can set its autoload value to “No” (if you’re unsure, you can ask on the WordPress.org support forum).
If you’re not sure which plugin an option belongs to, try searching the option name online.
Warning: before making any modifications to the database, always make a backup!

UPDATE wp_options SET autoload = 'no' WHERE option_name = 'example_option';

Additionally, you may have several unused options left behind by plugins you previously installed and then removed. Many plugins do not completely delete their data from the database.

If you are certain that some options are no longer in use, you can safely delete them instead of setting autoload to “No.”, this will speed up your WordPress site

DELETE FROM wp_options WHERE option_name IN ('option1', 'option2');

Or delete all options that contains a certain name:

DELETE FROM wp_options WHERE option_name LIKE '%optionname%';

Setting autoload to “No” for unnecessary options and deleting unused options will speed up your WordPress site, the loading time of my WordPress admin area dropped from 14-15 seconds to just 2-3 seconds!

Area di amministrazione WordPress

Identify and Remove Unused Tables

List all database tables:

SHOW TABLES;

The core WordPress tables are as follows:

  • wp_options
  • wp_users
  • wp_usermeta
  • wp_posts
  • wp_postmeta
  • wp_terms
  • wp_termmeta
  • wp_term_taxonomy
  • wp_term_relationships
  • wp_comments
  • wp_commentmeta
  • wp_links

Any additional tables may belong to a plugin or theme.

The easiest way to determine their origin is to search the table names online and see which plugin/theme they belong to.
If a table belongs to a plugin or theme that you no longer use, you can safely delete it:

DROP TABLE table1;

Plugins often store related data in tables such as wp_options, wp_postmeta, wp_usermeta, wp_termmeta, etc.

To check references to a specific table, perform a search in the metadata tables:

SELECT * FROM wp_options WHERE option_value LIKE '%table1%';
SELECT * FROM wp_postmeta WHERE meta_value LIKE '%table1%';
SELECT * FROM wp_usermeta WHERE meta_value LIKE '%table1%';
SELECT * FROM wp_termmeta WHERE meta_value LIKE '%table1%';

If references exist, you can delete them:

DELETE FROM wp_options WHERE option_value LIKE '%table1%';
DELETE FROM wp_postmeta WHERE meta_value LIKE '%table1%';
DELETE FROM wp_usermeta WHERE meta_value LIKE '%table1%';
DELETE FROM wp_termmeta WHERE meta_value LIKE '%table1%';

After deleting data, optimize tables to reclaim space.

Speed up your WordPress site with Automatic Database Cleanup plugin

There are several plugins designed for this purpose. Personally, I use Advanced Database Cleaner.

Speed up your WordPress site with Advanced Database Cleaner
Advanced Database Cleaner

In the General Clean-up tab, you can delete revisions, drafts, orphaned post meta, and more.

The Tables tab shows tables that need optimization.

The Options tab displays all options (those stored in the wp_options table) and indicates whether they are autoloaded or not.
Unfortunately, to access more detailed information, such as orphaned options, you need to purchase the Pro version of the plugin from the developer’s website.

Speed up your WordPress site by following these general recommendations

  • Use only the plugins that are absolutely necessary.
  • Check if there are lighter alternatives to the plugins you are currently using.
  • If you want to test a plugin’s features, install it on a staging or test site whenever possible.
  • When removing a plugin, check if it has an option for complete uninstallation that deletes all its data.
    If not, verify what data (e.g., options, tables) the plugin adds to the database and manually remove it via phpMyAdmin after deleting the plugin.
    If you’re unsure which data the plugin stores, you can ask in the plugin’s support forum on WordPress.org or look it up on https://plugintests.com (if available, check the “Additions” section).
  • Periodically use a database cleaning and optimization plugin.

These recommendations will help keep your WordPress site fast, optimized, and free from unnecessary data!

Support This Site

If you like what I do please support me on Ko-fi

Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

0 Commenti
Oldest
Newest Most Voted
Inline Feedbacks
View all comments