Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness. Use WP_Site::__get() instead.

WP_Site::get_details() WordPress Method

The WP_Site::get_details() method is used to get the details of a site from WordPress. This includes the site URL, name, description, and more.

WP_Site::get_details() #

Retrieves the details for this site.


Description

This method is used internally to lazy-load the extended properties of a site.

Top ↑

See also


Top ↑

Return

(stdClass) A raw site object with all details included.


Top ↑

Source

File: wp-includes/class-wp-site.php

318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
private function get_details() {
    $details = wp_cache_get( $this->blog_id, 'site-details' );
 
    if ( false === $details ) {
 
        switch_to_blog( $this->blog_id );
        // Create a raw copy of the object for backward compatibility with the filter below.
        $details = new stdClass();
        foreach ( get_object_vars( $this ) as $key => $value ) {
            $details->$key = $value;
        }
        $details->blogname   = get_option( 'blogname' );
        $details->siteurl    = get_option( 'siteurl' );
        $details->post_count = get_option( 'post_count' );
        $details->home       = get_option( 'home' );
        restore_current_blog();
 
        wp_cache_set( $this->blog_id, $details, 'site-details' );
    }
 
    /** This filter is documented in wp-includes/ms-blogs.php */
    $details = apply_filters_deprecated( 'blog_details', array( $details ), '4.7.0', 'site_details' );
 
    /**
     * Filters a site's extended properties.
     *
     * @since 4.6.0
     *
     * @param stdClass $details The site details.
     */
    $details = apply_filters( 'site_details', $details );
 
    return $details;
}


Top ↑

Changelog

Changelog
VersionDescription
4.6.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by the Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.