[wp-trac] [WordPress Trac] #22846: Site transient autoload even when they have expiry time

WordPress Trac noreply at wordpress.org
Tue Mar 29 17:11:33 UTC 2016

#22846: Site transient autoload even when they have expiry time
 Reporter:  mark-k              |       Owner:
     Type:  defect (bug)        |      Status:  new
 Priority:  normal              |   Milestone:  Awaiting Review
Component:  Options, Meta APIs  |     Version:  3.4.2
 Severity:  normal              |  Resolution:
 Keywords:  needs-patch         |     Focuses:  multisite, performance

Comment (by thomaswm):

 Replying to [ticket:22846 mark-k]:
 > I guess set_site_transient should set autoload to NO after calling
 add_site_option when there is expiration time.

 `add_site_option` does not have an "autoload" parameter. Moreover, the
 sitemeta table, where site options and site transients are stored, does
 not have a column called "autoload".

 Autoloading of network options happens in `wp_load_core_site_options()`,
 but there's a hardcoded list of options which are autoloaded.

 $core_options = array('site_name', 'siteurl', 'active_sitewide_plugins',
 '_site_transient_timeout_theme_roots', '_site_transient_theme_roots',
 'site_admins', 'can_compress_scripts', 'global_terms_enabled',
 'ms_files_rewriting' );

 $core_options_in = "'" . implode("', '", $core_options) . "'";
 $options = $wpdb->get_results( $wpdb->prepare("SELECT meta_key, meta_value
 FROM $wpdb->sitemeta WHERE meta_key IN ($core_options_in) AND site_id =
 %d", $site_id) );

 So, WordPress does not autoload site transients.

Ticket URL: <https://core.trac.wordpress.org/ticket/22846#comment:6>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform

More information about the wp-trac mailing list