[wp-trac] [WordPress Trac] #50391: Unnecessary switch_to_blog() in get_blog_details()
WordPress Trac
noreply at wordpress.org
Tue Jul 21 18:30:43 UTC 2020
#50391: Unnecessary switch_to_blog() in get_blog_details()
--------------------------------------+-----------------------------
Reporter: SergeyBiryukov | Owner: SergeyBiryukov
Type: defect (bug) | Status: closed
Priority: normal | Milestone: 5.5
Component: Networks and Sites | Version:
Severity: normal | Resolution: fixed
Keywords: good-first-bug has-patch | Focuses: multisite
--------------------------------------+-----------------------------
Comment (by tannergeddes12):
$switched_blog = false;
if ( get_current_blog_id() !== $blog_id ) {
switch_to_blog( $blog_id );
$switched_blog = true;
}
$details->blogname = get_option( 'blogname' );
$details->siteurl = get_option( 'siteurl' );
$details->post_count = get_option( 'post_count' );
$details->home = get_option( 'home' );
if ( $switched_blog ) {
restore_current_blog();
--
Ticket URL: <https://core.trac.wordpress.org/ticket/50391#comment:8>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list