• Hi, can anyone explain why the option can_compress_scripts is not an autoload option? It looks like it’s requested on every page load causing an extra DB query.

    When I set SAVEQUERIES and make them visible in the site footer, I ALWAYS see one like this among them:

    
    [3] => Array
            (
                [0] => SELECT option_value FROM wp_options WHERE option_name = 'can_compress_scripts' LIMIT 1
                [1] => 0.00071597099304199
                [2] => require('wp-blog-header.php'), require_once('wp-load.php'), require_once('/var/www/mydevsite/wp-config.php'), require_once('wp-settings.php'), do_action('init'), WP_Hook->do_action, WP_Hook->apply_filters, wp_widgets_init, do_action('widgets_init'), WP_Hook->do_action, WP_Hook->apply_filters, WP_Widget_Factory->_register_widgets, WP_Widget->_register, WP_Widget_Text->_register_one, wp_add_inline_script, wp_scripts, WP_Scripts->__construct, WP_Scripts->init, do_action_ref_array('wp_default_scripts'), WP_Hook->do_action, WP_Hook->apply_filters, wp_default_packages, wp_register_tinymce_scripts, script_concat_settings, get_site_option, get_network_option, get_option
                [3] => 1578269730.7855
                [4] => Array
                    (
                    )
    
            )
    
    • This topic was modified 5 years, 2 months ago by Jan Dembowski. Reason: Moved to Fixing WordPress, this is not a Requests and Feedback topic
Viewing 2 replies - 1 through 2 (of 2 total)
  • Hello!

    Did you try adding autoload = yes after your option name?
    I do not see it in the piece of code you currently added ??

    Thread Starter Rolf Allard van Hagen

    (@ravanh)

    Hi @vmit23 the option can_compress_scripts is a WordPress core option that has been there since version 2.8 apparently. I never noticed before but now, working on a plugin and debugging with WP_DEBUG and SAVEQUERIES, I notice the above query

    
    SELECT option_value FROM wp_options WHERE option_name = 'can_compress_scripts' LIMIT 1
    

    on every page, usually shortly after the main options query.

    This happens on a fresh new install without any plugins and seems senseless to me because if it where simply marked autoload, it would save one query per page request. Or is there some special reason why it is not an autoload option?

    Hence my question ??

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Option can_compress_scripts not autoload’ is closed to new replies.