With the release of WordPress 6.6 and its introduction to the new Site Health tool item “Autoloaded options could affect performance”, some users have begun noticing large autoloaded database entries, such as those used for theme settings, being flagged as potential performance risks.
One such entry is astra-settings, which stores all the customizer settings for Astra. This option is critical for ensuring core theme functionality on the frontend. However, in certain cases, you may choose to disable autoloading to optimize site performance, including:
- Sites with highly customized themes or extensive customizer settings
- Large autoloaded options flagged by the WordPress Site Health tool
- Performance issues on the frontend, such as slower page load times
- Older sites with accumulated settings are no longer relevant or actively used
Why Does Astra Use Autoloaded Options?
Autoloaded options are designed to load automatically with every page view, ensuring settings are always readily available. This feature has always existed in WordPress but has only recently come into focus due to the increased visibility provided by the new Site Health tool, making users more aware of these options.
This guide will walk you through convenient methods for safely disabling autoloading for the astra-settings option without affecting your site’s functionality.
Note: After disabling autoloading for the astra-settings option, it’s important to check your site to ensure that performance or functionality is not adversely affected.
Methods to Disable Autoloading for Astra-Settings
There are three ways to safely disable autoloading for Astra-settings. You can use a plugin, code snippet, or direct database update to do this, depending on your comfort level with WordPress tools and custom code.
Method 1: Using a Plugin (Recommended)
You can use a simple plugin to manage autoload options and disable autoloading for specific options. In this guide, we will be using the AAA Option Optimizer plugin which you can find from the WordPress plugin repository.
Steps:
- After plugin installation, go to the plugin’s settings page.
- Look for the astra-settings option in the list of autoloaded options.
- Disable autoloading for astra-settings by toggling it off.
This method allows for easy control of autoloaded options and ensures safe management without requiring coding knowledge.
Method 2: Using a Code Snippet
If you prefer to use custom code, you can disable autoloading for the astra-settings option by directly interacting with the database using a WordPress action hook.
Steps:
- Add the following code to Code Snippets plugins or your theme’s functions.php file or a custom plugin:
/**
* Disable autoload for the 'astra-settings' option.
*
* This function updates the 'astra-settings' option in the wp_options table
* to set its 'autoload' field to 'no'. This prevents WordPress from autoloading
* the settings during every page load, optimizing performance.
*
* Note: This only changes the autoload status of the option and does not modify the value.
*
* @global wpdb $wpdb WordPress database abstraction object.
*/
function disable_astra_settings_autoload() {
global $wpdb;
// Use $wpdb->update() to safely update the autoload value for the 'astra-settings' option.
$wpdb->update(
$wpdb->options,
array( 'autoload' => 'no' ),
array( 'option_name' => 'astra-settings' )
);
}
add_action( 'init', 'disable_astra_settings_autoload' );
- Save the file and refresh your website.
This code will update the astra-settings option in the wp_options table, disabling autoloading for it. Note that this approach is better suited for advanced users comfortable with editing code.
Method 3: Direct Database Update via SQL
For those with direct access to the database (e.g., through phpMyAdmin), you can manually update the astra-settings option.
Steps:
- Log in to your hosting control panel and access phpMyAdmin.
- Navigate to your WordPress database and open the wp_options table.
- Find the astra-settings option by searching for astra-settings in the option_name column.
- Edit the astra-settings row and change the autoload value from yes to no.
- Save the change.
This method directly modifies the database and is ideal for experienced users or developers.
Disabling autoloading for astra-settings can improve performance on highly customized sites. By following one of the methods above, you can ensure that your site runs smoothly without affecting core Astra functionality.
After making the changes, always check your site to confirm there are no performance or functionality impacts. If you’re unsure or need further assistance, consider consulting with a developer or support team to ensure the change is implemented safely.
We hope this guide has been helpful! If you have any questions, feel free to leave comments, and we’ll be glad to assist you.