WordPress.org

Make WordPress Core

Ticket #35791: 35791-get-site.diff

File 35791-get-site.diff, 1.4 KB (added by jeremyfelt, 3 years ago)

Remove $object parameter from get_site()

  • src/wp-includes/ms-blogs.php

     
    480480 * @global WP_Site $current_blog The current site.
    481481 *
    482482 * @param WP_Site|int $site   Site to retrieve.
    483  * @param string      $output Optional. Type of output to return. OBJECT or ARRAY_A or ARRAY_N constants.
    484483 * @return WP_Site|array|null Depends on $output value.
    485484 */
    486 function get_site( &$site = null, $output = OBJECT ) {
     485function get_site( &$site = null ) {
    487486        global $current_blog;
    488487        if ( empty( $site ) && isset( $current_blog ) ) {
    489488                $site = $current_blog;
     
    510509         */
    511510        $_site = apply_filters( 'get_site', $_site );
    512511
    513         if ( $output == OBJECT ) {
    514                 return $_site;
    515         } elseif ( $output == ARRAY_A ) {
    516                 return $_site->to_array();
    517         } elseif ( $output == ARRAY_N ) {
    518                 return array_values( $_site->to_array() );
    519         }
    520 
    521512        return $_site;
    522513}
    523514
  • src/wp-includes/ms-functions.php

     
    24882488        $results = array();
    24892489
    24902490        foreach ( $_sites as $_site ) {
    2491                 $results[] = get_site( $_site, ARRAY_A );
     2491                $results[] = (array) get_site( $_site );
    24922492        }
    24932493
    24942494        return $results;