Support » Plugin: Multisite Admin Bar Switcher » wp_get_sites -> get_sites

  • Resolved JP3

    (@jp3)


    Heads up. wp_get_sites has been replaced.

    For version 1.2.4 of your plugin,
    multisite-admin-bar-switcher.php line 411:

    from:
    $blog_list = wp_get_sites();

    to:
    $blog_list = get_sites();

    is enough to resolve it.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author flynsarmy

    (@flynsarmy)

    This should now be fixed in version 1.2.5.

    Thread Starter JP3

    (@jp3)

    Wow! Amazingly quick turnaround!

    Progress is good, but complicates things. For when you have the time, a way to resolve some of the unwanted complications due to this WP Core change would be to keep your backward compatibility with some checks like:

    if ( function_exists( 'get_sites' ) ) {
         code using the get_sites function
    } else {
         code using the wp_get_sites function
    }

    or if changing wp_get_sites truly was the only change you had to make to your plugin, you could do something like:

    if ( function_exists( 'get_sites' ) ) {
         $get_sites_func_name = 'get_sites';
    } else {
         $get_sites_func_name = 'wp_get_sites';
    }

    and then plug in $get_sites_func_name inplace of where ‘get_sites’ was replaced.

    Your plugin is awesome so I’m sure you’re already thinking about stuff like this. Thank you for your work on it!

    Plugin Author flynsarmy

    (@flynsarmy)

    I have no desire to keep compatibility with older versions of WP just as I don’t really try to keep compatible with older versions of PHP. The changes required to get get_sites() working were a little more complex than your original post. Here’s the commit log from back when I made the change (I only uploaded it here because your post earlier today reminded me to): https://github.com/Flynsarmy/wp-multisite-admin-bar-switcher/commits/master

    Plugin Author flynsarmy

    (@flynsarmy)

    The issue in the original post is now fixed.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘wp_get_sites -> get_sites’ is closed to new replies.