• koullis

    (@koullis)


    after 6.6 update i keep getting this health issue

    1 critical issue

    Autoloaded options could affect performance

    Autoloaded options are configuration settings for plugins and themes that are automatically loaded with every page load in WordPress. Having too many autoloaded options can slow down your site. Your site has 1922 autoloaded options (size: 2 MB) in the options table, which could cause your site to be slow. You can review the options being autoloaded in your database and remove any options that are no longer needed by your site.

    • This topic was modified 3 months ago by koullis.
Viewing 15 replies - 1 through 15 (of 21 total)
  • studihi

    (@studihi)

    I also experienced the same thing

    misselenat

    (@misselenat)

    My website had the same issue, even though the size of the autoloaded options was around 800kb. After deleting some parameters (belonging to already uninstalled plugins) from wp_options (inside PHPMyAdmin), I changed the file size limit to 900kb so as to prevent the message from appearing.

    I found the line 2648:

        $limit = apply_filters( 'site_status_autoloaded_options_size_limit', 800000 );

    in wp-admin > includes > class-wp-site-health.php and simply changed 800000 to 900000.

    If the size of your autoloaded options exceeds 1MB, I would address the issue first by removing any old parameters from wp_options inside PHPMyAdmin (make a copy of the database before deleting anything, of course).

    Hope this helps!

    • This reply was modified 3 months ago by misselenat.
    Thread Starter koullis

    (@koullis)

    thanks i managed to make it 1mb but still showed error and then did your solution but this must be done each time an update is available

    You are right about having to do this each time a WordPress update is available, let’s just consider this a workaround until a better solution comes up.

    I’m wondering if there is a way to prevent this value from being overwritten by updates, the same way you can prevent a file belonging to a theme from being updated by putting a copy of the modified file in the theme’s child folder (the child folder always has priority, provided the active theme is the child one of course).

    I will try and see if I find a solution, meantime I’ll just manually change the value after every WordPress udpate.

    • This reply was modified 2 months, 4 weeks ago by misselenat.
    Thread Starter koullis

    (@koullis)

    like you said maybe there is a way through child theme and meantime reedit file on each update

    highlandmoss

    (@highlandmoss)

    This might be useful for some people, it is a little snippet I got chatgpt to write for me. Just tested it and it works fine. I manually went through all my options with Meow Apps DB cleaner and disabled autoload from as many old plugins relics as I could recognise. I also have AAA option optimizer on for a few days to see if it helps find unused options that I can clean up.

    Anyway, this would solve the issue you guys have about updates replacing the modified code.

    // Add this to your theme's functions.php or a custom plugin

    function custom_update_autoloaded_options_size_limit($limit) {
    // Set the default custom limit to 999999 bytes (approx. 1MB)
    $custom_limit = get_option('custom_autoloaded_options_size_limit', 999999);

    // Ensure the limit is within a reasonable range (e.g., between 800KB and 999999 bytes)
    if ($custom_limit < 800000) {
    $custom_limit = 800000;
    } elseif ($custom_limit > 999999) {
    $custom_limit = 999999;
    }

    return $custom_limit;
    }

    add_filter('site_status_autoloaded_options_size_limit', 'custom_update_autoloaded_options_size_limit');
    misselenat

    (@misselenat)

    Thank you very much, I will try that next time there is an update!

    misselenat

    (@misselenat)

    I’ve actually created a custom plugin and reinstalled the latest WordPress version – your code works like a charm. Thank you @highlandmoss!

    B

    (@blclda)

    Hello, I’d like to report a bug with the autoloader panel, just like with @misselenat, our total Autoload Size is 773 KB, see here. This is checking with the plugin: https://www.ads-software.com/plugins/autoload-checker/

    YET, when I go on site health I still see the Autoloaded options and when I click on it says “Your site has 1814 autoloaded options (size: 2 MB)”, see here.

    Why does this happen and what can I do to fix it?

    Adjusting the threshold for large options

    add_filter( 'wp_max_autoloaded_option_size', 'my_max_autoload_option_size' );

    function my_max_autoload_option_size( $size ) {
    // Reduce the threshold for large sizes to 100K (Default is 150K).
    return 100000;
    }

    If you want to change the size threshold for when options should no longer be autoloaded, you can use the new?wp_max_autoloaded_option_size?filter. Increasing this value is not recommended, as it could lead to slower performance.

    @blclda I also get the same issue as you. I ran AAA optimiser to clear out some particularly large options files and turn off some that were not required to autoload.

    New size down to just over 400kb (down from nearly 2MB)

    But I still get a message when running WordPress Site Health Check (over 2MB). I suspect it’s a bug that it’s storing this value somewhere and not refreshing it when you re-run site health (or maybe it will only recheck after X days).

    Be good to find out if there’s a bug report logged already for this and/or if anyone else is having this issue.

    Thread Starter koullis

    (@koullis)

    @highlandmoss added your snipped and worked after the new update.just adjusted the size

    thank you

    I′ve added some code to @highlandmoss snipped to easily change the options size limit in the wordpress settings.

    Simply create a plugin and insert this code:

    <?php
    /*
    Plugin Name: Custom Autoloaded Options Size Limit
    Plugin URI: https://example.com
    Description: Dieses Plugin setzt ein benutzerdefiniertes Limit für autoloaded options size im WordPress-Backend.
    Version: 1.0
    Author: Dein Name
    Author URI: https://example.com
    License: GPL2
    */

    // Funktion, um das benutzerdefinierte Limit für autoloaded options zu setzen
    function custom_update_autoloaded_options_size_limit($limit) {
    // Standardwert: 999999 Bytes (ca. 1MB)
    $custom_limit = get_option('custom_autoloaded_options_size_limit', 999999);

    // Sicherstellen, dass das Limit in einem vernünftigen Bereich liegt (zwischen 800KB und 1.3MB)
    if ($custom_limit < 800000) {
    $custom_limit = 800000;
    } elseif ($custom_limit > 999999) {
    $custom_limit = 1300000;
    }

    return $custom_limit;
    }

    // Den Filter anwenden, um das benutzerdefinierte Limit zu aktivieren
    add_filter('site_status_autoloaded_options_size_limit', 'custom_update_autoloaded_options_size_limit');

    // Menüpunkt im Backend hinzufügen
    function custom_autoload_options_limit_menu() {
    add_options_page(
    'Autoload Options Limit', // Seitentitel
    'Autoload Options Limit', // Menü-Titel
    'manage_options', // Berechtigungen
    'custom-autoload-options-limit',// Slug
    'custom_autoload_options_limit_page' // Callback-Funktion
    );
    }
    add_action('admin_menu', 'custom_autoload_options_limit_menu');

    // Seite im Backend zur Einstellung des Limits
    function custom_autoload_options_limit_page() {
    ?>
    <div class="wrap">
    <h1>Custom Autoloaded Options Size Limit</h1>
    <form method="post" action="options.php">
    <?php
    settings_fields('custom_autoload_options_limit_group');
    do_settings_sections('custom-autoload-options-limit');
    submit_button();
    ?>
    </form>
    </div>
    <?php
    }

    // Einstellungen registrieren
    function custom_autoload_options_limit_settings() {
    register_setting('custom_autoload_options_limit_group', 'custom_autoloaded_options_size_limit');

    add_settings_section(
    'custom_autoload_options_limit_section', // ID
    'Einstellungen für Autoloaded Options Size Limit', // Titel
    null, // Callback
    'custom-autoload-options-limit' // Slug
    );

    add_settings_field(
    'custom_autoloaded_options_size_limit', // ID
    'Maximale Gr??e in Bytes', // Titel
    'custom_autoload_options_limit_field_callback', // Callback-Funktion
    'custom-autoload-options-limit', // Seite
    'custom_autoload_options_limit_section' // Sektion
    );
    }
    add_action('admin_init', 'custom_autoload_options_limit_settings');

    // Eingabefeld anzeigen
    function custom_autoload_options_limit_field_callback() {
    $limit = get_option('custom_autoloaded_options_size_limit', 999999);
    echo '<input type="number" name="custom_autoloaded_options_size_limit" value="' . esc_attr($limit) . '" />';
    }

    I am getting the same alert in my Site Health Status. I am not a programmer and have no idea how to fix this issue. Is there a WordPress rep who can help or do I have hire someone to fix it? I’m just getting started with my eCommerce site and don’t have a lot of money to throw at this problem. Thank you in advance for your help.

    kelly127

    (@kelly127)

    @dominikw1980 I added your code to theme’s functions.php file but nothing changed.

Viewing 15 replies - 1 through 15 (of 21 total)
  • You must be logged in to reply to this topic.