From 53ec2e744d706e5b82de1f6ac8e70d0636b81ea3 Mon Sep 17 00:00:00 2001 From: Jeremy Felt Date: Wed, 8 Jun 2016 02:47:48 +0000 Subject: [PATCH] Multisite: Remove the output parameter from `get_site()` Full `WP_Site` objects should be expected from `get_site()` rather than arrays. In the single (soon to be deprecated) use of arrays for this in core, we can cast the result to `(array)` for back-compat. See #35791. git-svn-id: https://develop.svn.wordpress.org/trunk@37652 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/ms-blogs.php | 13 ++----------- src/wp-includes/ms-functions.php | 2 +- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/src/wp-includes/ms-blogs.php b/src/wp-includes/ms-blogs.php index 82a1206dd0..0516bfbed4 100644 --- a/src/wp-includes/ms-blogs.php +++ b/src/wp-includes/ms-blogs.php @@ -479,11 +479,10 @@ function clean_blog_cache( $blog ) { * * @global WP_Site $current_blog The current site. * - * @param WP_Site|int $site Site to retrieve. - * @param string $output Optional. Type of output to return. OBJECT or ARRAY_A or ARRAY_N constants. + * @param WP_Site|int $site Site to retrieve. * @return WP_Site|array|null Depends on $output value. */ -function get_site( &$site = null, $output = OBJECT ) { +function get_site( &$site = null ) { global $current_blog; if ( empty( $site ) && isset( $current_blog ) ) { $site = $current_blog; @@ -510,14 +509,6 @@ function get_site( &$site = null, $output = OBJECT ) { */ $_site = apply_filters( 'get_site', $_site ); - if ( $output == OBJECT ) { - return $_site; - } elseif ( $output == ARRAY_A ) { - return $_site->to_array(); - } elseif ( $output == ARRAY_N ) { - return array_values( $_site->to_array() ); - } - return $_site; } diff --git a/src/wp-includes/ms-functions.php b/src/wp-includes/ms-functions.php index 197c7dd28c..b907cb73d9 100644 --- a/src/wp-includes/ms-functions.php +++ b/src/wp-includes/ms-functions.php @@ -2488,7 +2488,7 @@ function wp_get_sites( $args = array() ) { $results = array(); foreach ( $_sites as $_site ) { - $results[] = get_site( $_site, ARRAY_A ); + $results[] = (array) get_site( $_site ); } return $results;