WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 3 years ago

#37553 closed enhancement (fixed)

Deprecate `wp_get_network()`

Reported by: flixos90 Owned by: jeremyfelt
Milestone: 4.7 Priority: normal
Severity: normal Version:
Component: Networks and Sites Keywords: has-patch commit
Focuses: multisite Cc:
PR Number:

Description

Now with get_network() in, the old function wp_get_network() should be deprecated as discussed earlier.

Attachments (2)

37553.patch (498 bytes) - added by PieWP 3 years ago.
Added deprecation notice
37553.diff (1.5 KB) - added by flixos90 3 years ago.

Download all attachments as: .zip

Change History (9)

@PieWP
3 years ago

Added deprecation notice

#1 @PieWP
3 years ago

  • Keywords has-patch added; needs-patch removed

Thanks for your observation flixos90, patch file added

#2 follow-up: @flixos90
3 years ago

Thanks for the patch @PieWP! We would also need to add the deprecation to the PHPDoc of the function.

And then we get to the tricky part: ms-deprecated.php is loaded after Multisite bootstrap processes, however this function is currently available at that point. What do we do here? Just leave it there and still deprecate it? Adjust the order of files loaded? Or introduce a new file for this kind of deprecated multisite functions (like ms-load-deprecated.php)?

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

  • Milestone changed from Future Release to 4.7
  • Type changed from defect (bug) to enhancement

Replying to flixos90:

And then we get to the tricky part: ms-deprecated.php is loaded after Multisite bootstrap processes, however this function is currently available at that point. What do we do here? Just leave it there and still deprecate it?

We're good to leave it in ms-load.php, we can move it to the bottom of the file.

This is kind of fun because the introduction of wp_get_network() itself in #27003 led to the deprecation of get_current_site_name(). I guess this is progress... :)

See https://core.trac.wordpress.org/ticket/27003#comment:44 for a good summary.

@flixos90
3 years ago

#4 @flixos90
3 years ago

  • Keywords commit added
  • Owner set to jeremyfelt
  • Status changed from new to reviewing

In 37553.diff, wp_get_network() is now deprecated and moved to the bottom of ms-load.php.

#5 follow-up: @jorbin
3 years ago

Should there be a comment about why the function is located here rather than with the other deprecated functions?

#6 in reply to: ↑ 5 @jeremyfelt
3 years ago

Replying to jorbin:

Should there be a comment about why the function is located here rather than with the other deprecated functions?

I don't think we need to do that on each function. It may be worth adding a comment above the first deprecated function in this file, get_current_site_name(), to indicate that any deprecated functions from ms-load.php should go here, but that would probably be another ticket.

#7 @jeremyfelt
3 years ago

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

In 38515:

Multisite: Deprecate wp_get_network().

wp_get_network() was converted into a wrapper for get_network() in 4.6.0 and can now be deprecated.

This moves wp_get_network() to the bottom of ms-load.php as ms-deprecated.php is not available early enough.

Props PieWP, flixos90.
Fixes #37553.

Note: See TracTickets for help on using tickets.