WordPress.org

Make WordPress Core


Ignore:
Timestamp:
05/20/2016 04:40:39 AM (5 years ago)
Author:
jeremyfelt
Message:

Multisite: Introduce get_site()

Given a site ID or site object, get_site() retrieves site data in the same vein as get_post() or get_comment(). This will allow for clean retrieval of sites from a primed cache when WP_Site_Query is implemented.

Adds a WP_Site::to_array() method to support multiple return types within get_site().

Props spacedmonkey.
See #35791.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-site.php

    r36495 r37468  
    199199        }
    200200    }
     201
     202    /**
     203     * Converts an object to array.
     204     *
     205     * @since 4.6.0
     206     * @access public
     207     *
     208     * @return array Object as array.
     209     */
     210    public function to_array() {
     211        return get_object_vars( $this );
     212    }
    201213}
Note: See TracChangeset for help on using the changeset viewer.