multisite: Performance –> heavy switch_to_blog
-
Hello,
thanks for your plugin!
We have big performance problems in wp-admin, so I looked inside your code.1. You use
switch_to_blog( 1 );andrestore_current_blog();in many places. These functions are very heavy. –> You can just useupdate_blog_option( 1, ..., ... );instead of switching to blog 1 to useupdate_option( ..., ... );.2. You switch to blog 1 even if you are on blog 1: You only check for
is_multisite(). Please check foris_multisite() && !is_main_site()instead.3. In two places you call the
global $blog_id. (in function ask() and function warning() ). –> Just call here againif ( ( is_multisite() && ( !is_main_site() ...This didn’t solve my performance issue yet, but it’s a better way of handling multisite.
Thanks in advance
The topic ‘multisite: Performance –> heavy switch_to_blog’ is closed to new replies.