[wp-trac] [WordPress Trac] #46351: Properly re-fill the `$meta` param of deprecated `wpmu_new_blog` action

WordPress Trac noreply at wordpress.org
Tue Feb 26 18:10:21 UTC 2019


#46351: Properly re-fill the `$meta` param of deprecated `wpmu_new_blog` action
--------------------------------+-----------------------------
 Reporter:  david.binda         |      Owner:  (none)
     Type:  defect (bug)        |     Status:  new
 Priority:  normal              |  Milestone:  Awaiting Review
Component:  Networks and Sites  |    Version:  5.1
 Severity:  normal              |   Keywords:
  Focuses:  multisite           |
--------------------------------+-----------------------------
 The updates in r43548 changed the way how `$meta` value passed to
 `wpmu_new_blog` is being populated.

 It introduces the `$site_data_whitelist` array (see
 https://core.trac.wordpress.org/browser/trunk/src/wp-includes/ms-
 functions.php?rev=43548#L1288 ) which contains keys of properties which
 are now being passed to `wp_insert_site`, where those are being processed,
 and removes those keys from the `$meta` array.

 The list of keys was previously used for identifying what properties are
 being saved as site options, but those were still passed to
 `wpmu_new_blog` action in terms of `$meta` param. (see
 https://core.trac.wordpress.org/browser/trunk/src/wp-includes/ms-
 functions.php?rev=42976#L1309 )

 That said, after the 5.1.0, the `$meta` in `wpmu_new_blog` no longer
 contain any of following properies:

 {{{#!php
 <?php
 $site_data_whitelist = array( 'public', 'archived', 'mature', 'spam',
 'deleted', 'lang_id' );
 }}}

 Further, in r43654 the `WPLANG`, previously default meta in
 `wpmu_create_blog` was moved elsewhere, and is also not available among
 `$meta` in `wpmu_new_blog` action.

 While the `wpmu_create_blog` is no longer the recommend way of creating
 new blogs, and `wpmu_new_blog` action have been deprecated, there still
 are some integrations out there, which may rely on the previous version of
 the `$meta` array.

 I'm attaching a patch for properly re-filling the values and a unit test
 demonstrating the issue. The patch is introducing more values to the
 `$meta`, since the current implementation really wants to re-populate the
 `$meta` variable in case there are some callbacks hooked to
 `wpmu_new_blog` action, so it's easier to pass more data (with default
 values), than adjusting the `wp_insert_site` function the way it only
 passes the same limited set of properties.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/46351>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list