Skip to:
Content

#7326 closed defect (bug) (fixed)

`get_blog_details()` will be deprecated in WordPress 4.8

Reported by: netweb Owned by: djpaul
Milestone: 2.8 Priority: normal
Severity: normal Version:
Component: Build/Test Tools Keywords: needs-patch
Cc:

Description

Via https://make.wordpress.org/core/2016/11/04/multisite-focused-changes-in-4-7/


get_blog_details() replaced with get_site()
A lot of progress has been made over the last few releases to get things in place for this transition. Now that WP_Site and WP_Network objects exist and are accessible with functions like get_site() and get_network(), they can be implemented throughout core.

In WordPress 4.7, get_blog_details() was replaced throughout core code with the modern get_site(). The roadmap for this includes deprecating get_blog_details() in WordPress 4.8, so take this cycle as a chance to move your code in that direction.

get_site() is often a direct replacement, though get_sites() can also be used to query for sites when an ID is not available.

See #WP37102 for details on this change.

The BuddyPress PHPUnit test suite uses get_blog_details() in the following locations:

https://buddypress.trac.wordpress.org/browser/trunk/tests/phpunit/includes/testcase.php#L348
https://buddypress.trac.wordpress.org/browser/trunk/tests/phpunit/includes/testcase.php#L353

Related: #bbPress3015

Change History (3)

#1 @DJPaul
13 months ago

Those lines are within the horrendous go_to() test method, inside a block that only executes if WP < 3.9, so this isn't an immediate priority (this would obviously execute without notice on WP 389, because it's been deprecated in 4.7).

It looks like core's test suite has tidied up go_to(), and I think I only duplicated the method initially because clean_up_global_scope() was not actually working to clean up everything BP adds to the global scope, and this was the easiest fix rather than debug the entire stuck (see the section under "For BuddyPress, James.").

#2 @DJPaul
13 months ago

  • Milestone changed from Awaiting Review to 2.8

#3 @djpaul
13 months ago

  • Owner set to djpaul
  • Resolution set to fixed
  • Status changed from new to closed

In 11254:

Tests: rely on WP Core's version of go_to().

Our version of go_to() is very messy, and since we copied it a few years ago, it has been refactored in WordPress.
We can remove the duplication which makes for a cleaner method, and rely on the upstream version.

This also helps avoid false positives in tools that check for use of deprecated WordPress functions.
There was a conditional block in the old go_to() that was for compatibility with WordPress <3.9.

Fixes #7326

Props netweb, DJPaul

Note: See TracTickets for help on using tickets.