update_site_option being used unnecessarily
-
I am tuning my site page loading and noticed that a lot of calls to the database to fetch __ina_* options. I was surprised that these options were not being loaded as part of wp_load_alloptions. However, on checking the database I noticed that all these options had been created with autoload=no.
I think there is a problem in the logic of Helpers::update_option function:
if ( is_network_admin() && is_multisite() || ( get_current_blog_id() == get_main_network_id() ) ) {
update_site_option( $key, $value );
} else {
update_option( $key, $value );
}This is going through the update_site_option branch despite my site NOT being a multisite. Note that update_site_option calls update_network_option which, in the case of not multsite, calls update_option with autoload=false. Hence, what I’m seeing in the database.
I’ve checked each element of the if statement:
- is_network_admin() = false
- is_multisite() = false
- get_current_blog_id() = 1
- get_main_network_id() =1 (which is always the case if not multisite)
So I think the if statement logic is flawed. Please could you have a look/correct this.
- You must be logged in to reply to this topic.