• 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 ); and restore_current_blog(); in many places. These functions are very heavy. –> You can just use update_blog_option( 1, ..., ... ); instead of switching to blog 1 to use update_option( ..., ... );.

    2. You switch to blog 1 even if you are on blog 1: You only check for is_multisite(). Please check for is_multisite() && !is_main_site() instead.

    3. In two places you call the global $blog_id. (in function ask() and function warning() ). –> Just call here again if ( ( 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

    http://ww.wp.xz.cn/extend/plugins/better-wp-security/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Interested to know as well.

    Thread Starter Fee

    (@wdfee)

    are there any chances that this is for interest for the developers in here? maybe I should write it another way: My suggestions didn’t solve the performance issues completely, but they improve performance a lot.
    So, I’d be happy with updating your plugin without code hacking it…

    Hey Fee,

    Are you sure the switch_to_blogs are causing the issues? Your point about using update_blog_option vs switch_to_blog isn’t totally accurate… if you look here you’ll see core does just that.

    Perhaps its something else?

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘multisite: Performance –> heavy switch_to_blog’ is closed to new replies.