How to Clean Up Autoloaded Options in WordPress

Updated onJanuary 21, 2025

Clean up Autoloaded Options In WordPress

You may have already experienced a WordPress site slowing down. Heavy images or an outdated plugin could be the culprit, but bloated autoloaded options in your WordPress database are a very often overlooked cause.

These options are very important in WordPress but become problematic when poorly managed. Cleaning up autoloaded options in WordPress can dramatically improve site performance. Every WordPress developer should learn how to clean up autoloaded options. It will make your site faster, lighter, and more reliable.

This is the complete guide about autoloaded options, detailing everything you want to know. We’ll explore what autoloaded options are, how they affect your site’s performance, and how to clean them up right.

What Are Autoloaded Options in WordPress?

Autoloaded options are one type of data stored in your WordPress database’s wp_options table. This table holds many settings, including theme configurations, plugin settings, and even core WordPress options. Options marked as autoloaded are loaded automatically with every page request, whether needed on that page or not.

For instance, if a visitor visits your homepage, WordPress will load the content, images, and autoload options into memory. This mechanism speeds up certain functions but becomes problematic when the autoloaded data grows too large or contains unnecessary options.

Some common sources of bloated autoloaded options in WordPress are:

  1. Plugins that have left behind their data after uninstallation.
  2. Themes that retain configuration options even when they are inactive.
  3. Plugins that tag all options as autoloaded, even those needed only occasionally.

While WordPress’s autoloaded options are very convenient, too many options can damage your site. You should recognize and manage your autoloaded options so that your site runs smoothly.

Why Clean Up Autoloaded Options in the WordPress?

Not just tidying up your database, cleaning up autoloaded options directly impacts site performance. When autoloaded options become too huge, the amount of server memory and processing they occupy increases page loading times and resource usage.

Key Reasons Why You Should Clean Up Autoloaded Options in WordPress

  1. Fast loading: Every byte has its weightage while loading a landing page. Cleaning autoloaded data can save seconds off your site’s loading time.
  2. Lower Server Load: A lightweight database will place less stress on your server and help with peak traffic.
  3. Better Scalability: If your site grows, a tidy database will ensure it can handle heavy traffic.
  4. Better User Experience: A faster website equals a happy user and better SEO rankings.

For instance, if your autoloaded options exceed 1MB, they tend to exceed your system’s object caching limits, which can be Redis or Memcached. This causes WordPress to query the database twice, slowing your site and wasting your server resources simultaneously.

How to Detect the Size of Autoloaded Options in WordPress

Before you start cleaning, you must determine the size of your autoloaded options. This will tell you if there is a problem and which options are causing the most problems.

– With phpMyAdmin

This is one of the most popular tools for WordPress database management. You can check for autoloaded option sizes:

  • Log in to phpMyAdmin through your hosting control panel.
  • Select your WordPress database and navigate to the wp_options table.

phpMyAdmin WordPress Database

  • Run the following SQL query to view the largest autoloaded options:
sql

CopyEdit

SELECT option_name, LENGTH(option_value) AS option_size

FROM wp_options

WHERE autoload = 'yes'

ORDER BY option_size DESC;

To find the total size of all autoloaded options, run this query:

sql

CopyEdit

SELECT SUM(LENGTH(option_value)) AS total_size

FROM wp_options

WHERE autoload = 'yes';

These queries will give you an idea of the largest autoloaded rows and the overall size of autoloaded data. If it exceeds 1MB, it’s time to clean up.

– Using WP-CLI

Advanced users can use WP-CLI, which offers a faster method to check autoloaded options. First, install the WP-Doctor package:

bash

CopyEdit

wp package install wp-cli/doctor-command

Then, you run the following command to check the size of autoloaded options:

bash

CopyEdit

wp doctor check autoload-options-size

This tool shows the size and gives recommendations on optimizing your database.

How to Clean Up Autoloaded Options in WordPress

Step 1: Backup Your Database

Always start with a complete database backup to restore your website in case something gets wrong during cleaning. You should use a plugin like UpdraftPlus or go through phpMyAdmin to manually export.

Step 2: Get Rid of Useless Options

You can remove large or unused autoloaded options using the mentioned queries or WP-CLI commands. Watch out for options that point to inactive plugins, or themes-you can remove all of them.

Step 3: Manual Clean Up Autoloaded Options with phpMyAdmin

To manually clean up autoloaded options:

  1. Log in to phpMyAdmin and access the wp_options table.
  2. Locate the unnecessary option and delete it directly.
  3. To disable autoload for an option, change its autoload value from “yes” to “no.”

Step 4: Cleanup with WP-CLI

WP-CLI simplifies the process of cleaning up autoloaded options for developers. To delete an unnecessary option:

bash

CopyEdit

wp option delete option_name

To disable autoload for an option:

bash

CopyEdit

wp option set-autoload option_name no

Step 5: Use Plugins for Advanced Cleanup

Plugins such as the Advanced Database Cleaner can do the job if you don’t enjoy coding. These plugins check your database for orphaned data and present a user-friendly interface for removing it.

Advanced Database Cleaner Plugin

When to Clean Up Autoloaded Options?

Cleaning up autoloaded options is not something you need to do regularly, but there are scenarios when it becomes necessary:

  1. Your Site is Slow: If your site’s performance has drastically declined, bloated autoloaded options might be the cause.
  2. You’ve Changed Themes or Plugins: Theme or plugin changes usually leave autoloaded data, which is unnecessary.
  3. High Database Usage: If your database uses too many server resources, check the size of the autoloaded options.

Regularly checking your database lets you catch issues before they impact your site.

Object Caching and Autoloaded Options

If you’re using object caching tools like Redis or Memcached, bloated autoloaded options can create additional problems. These caching systems often have a limit on the size of objects they can store. If the size of your autoloaded options exceeds this limit, WordPress may bypass the cache and query the database twice, leading to slower performance.

To avoid this, ensure your autoloaded options size stays under 1MB. Regular monitoring and clean-up of autoloaded options can prevent these issues.

How WPExperts Can Help

Managing autoloaded options can be a technical challenge, especially for large or complex WordPress sites. That’s where WPExperts comes in to help you clean up autoloaded options in WordPress. We specialize in WordPress optimization, including database cleanup, performance tuning, and advanced caching solutions.

Whether you need help cleaning autoloaded options or want a complete performance audit, our experienced team can optimize your website for speed and scalability.

Last Words

Of course, cleaning up autoloaded options is an important step in improving your website’s performance and reliability. Identifying and removing unnecessary options can reduce server load, improve loading times, and create a better visitor experience.

Cleaning up autoloaded options using phpMyAdmin, WP-CLI, and some Advanced Database Cleaner plugins is as easy as a walk in the park.

Check your autoloaded options size today. If you need the professional help of WPExperts, simply contact us now!

Take control of your database today for a faster, more efficient WordPress site.


Sidebanner
sidebanner

Article by

Muhammad Jaffer

Muhammad Jaffer is a WooCommerce expert with 7+ years of experience in development, Blogging, SEO, and social media marketing. A passionate individual with a Bachelor’s in Technology, he creates custom-optimized WooCommerce solutions that drive business growth. He has experience working with startups and top companies like WPExperts.


Share This Article

Get In touch