Viewing 2 replies - 1 through 2 (of 2 total)
  • Thanks for catching this. I guess no problem editing plug directly as this won’t be updated any time soon…

    NOTE that the old wp_get_sites() function returned an array of sites, with the details nested in another array.

    The new get_sites() function returns the same array, but the details are nested inside an object (instead of an array).

    This caused me to have to change my code in a foreach loop I ran against the returned results.

    OLD:

    
    $sites = wp_get_sites();
    $site_ids = array();
    
    foreach ($sites as $site ) {
    
        $site_ids[] = $site['blog_id'];
    }
    

    NEW:

    
    $sites = get_sites();
    $site_ids = array();
    
    foreach( $sites as $site ) {
    
      $site_ids[] = $site->blog_id;
    }
    

    Hope this helps!

    • This reply was modified 8 years, 2 months ago by Josh.
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘wp_get_sites() is now get_sites()’ is closed to new replies.