Make WordPress Core

Opened 8 years ago

Closed 8 years ago

Last modified 4 years ago

#38491 closed enhancement (fixed)

Deprecate the `blog_details` filter

Reported by: flixos90's profile flixos90 Owned by: jeremyfelt's profile jeremyfelt
Milestone: 4.7 Priority: normal
Severity: normal Version:
Component: Networks and Sites Keywords: has-patch has-dev-note
Focuses: multisite Cc:

Description

Per discussion during multisite office-hours (https://wordpress.slack.com/archives/core-multisite/p1477413103001760) we are going to deprecate the blog_details filter and advise developers to use site_details instead.

One issue with that is since we have been replacing all the get_blog_details() calls in Core with get_site() (see #37102), the blog_details filter isn't run at all in some of these occasions. Therefore we will also add the blog_details filter (as deprecated) to WP_Site::get_details() to maintain backward compatibility.

The function get_blog_details() will also be deprecated very soon, likely in the next release.

Because of the complexity of these function replacements and the deprecated filter we need to write a dev-note on this or at least make it a highlighted topic on the general multisite dev-note.

Attachments (2)

38491.diff (12.3 KB) - added by flixos90 8 years ago.
38491.2.diff (1.0 KB) - added by flixos90 8 years ago.

Download all attachments as: .zip

Change History (8)

#1 @flixos90
8 years ago

  • Owner set to flixos90
  • Status changed from new to assigned

Status of this and the related tickets:

  • #38351 and #38355 will be committed later today.
  • I will work on a patch for this and #38350 now.

@flixos90
8 years ago

#2 follow-up: @flixos90
8 years ago

  • Keywords has-patch added; needs-patch removed
  • Owner changed from flixos90 to jeremyfelt
  • Status changed from assigned to reviewing

38491.diff deprecates the blog_details filter and makes it available in WP_Site::get_details() to maintain BC.

It also replaces get_blog_details() with get_site() in all unit tests that do not test get_blog_details() specifically.

Note: #38350, #38351 and #38355 should probably go in before this one.

#3 in reply to: ↑ 2 @jeremyfelt
8 years ago

Replying to flixos90:

38491.diff deprecates the blog_details filter and makes it available in WP_Site::get_details() to maintain BC.

Looking good. apply_filters_deprecated() already runs has_filter() as its first line, so we can probably skip that part.

It also replaces get_blog_details() with get_site() in all unit tests that do not test get_blog_details() specifically.

Let's handle this separately as part of #37102.

@flixos90
8 years ago

#4 @flixos90
8 years ago

  • Keywords needs-dev-note added

38491.2.diff removes the unnecessary has_filter() check and also gets rid of unit test replacements which will be handled separately.

#5 @jeremyfelt
8 years ago

  • Resolution set to fixed
  • Status changed from reviewing to closed

In 38936:

Multisite: Deprecate the blog_details filter.

get_site() has replaced get_blog_details() throughout core and is the recommended way to retrieve a current or single site object.

The blog_details filter is applied when full details are requested from get_blog_details().

To ensure backwards compatibility in the switch to get_site(), this blog_details filter is now applied in WP_Site::get_details() and marked as deprecated with a note to rely instead on the site_details filter introduced in 4.6.

Props flixos90.
See #37102.
Fixes #38491.

#6 @desrosj
4 years ago

  • Keywords has-dev-note added; needs-dev-note removed

Linking the dev note that was published here for reference: https://make.wordpress.org/core/2016/11/04/multisite-focused-changes-in-4-7/

Note: See TracTickets for help on using tickets.