[wp-trac] [WordPress Trac] #41333: Implement `wp_initialize_site()` and `wp_uninitialize_site()`

WordPress Trac noreply at wordpress.org
Wed Aug 8 11:50:00 UTC 2018


#41333: Implement `wp_initialize_site()` and `wp_uninitialize_site()`
-------------------------------------------------+-------------------------
 Reporter:  flixos90                             |       Owner:  flixos90
     Type:  enhancement                          |      Status:  assigned
 Priority:  normal                               |   Milestone:  5.0
Component:  Networks and Sites                   |     Version:
 Severity:  normal                               |  Resolution:
 Keywords:  ms-roadmap has-patch needs-unit-     |     Focuses:  multisite
  tests needs-testing dev-feedback               |
-------------------------------------------------+-------------------------

Comment (by flixos90):

 [attachment:"41333.2.diff"] makes the following changes (as described
 above):

 * Use `wp_initialize_site` and `wp_uninitialize_site` instead of
 `wp_install_site` and `wp_uninstall_site`.
 * Update documentation to reflect the above wording too.
 * Introduce `wp_is_site_initialized()` and a `pre_wp_is_site_initialized`
 hook inside it. Use that function in
 `wp_update_blog_public_option_on_site_update()` so that that function can
 always be hooked in regardless of whether a site is initialized or not.
 * Deprecate `wpmu_new_blog` and move it into `wp_insert_site()`.
 * Deprecate `delete_blog` and `deleted_blog` and move them into
 `wp_delete_site()`. Since the hooks still need to be executed when the
 site is not deleted, but only its `deleted` flag is set,
 `wpmu_delete_blog()` flow has been adjusted and it conditionally runs
 those actions as well. The parts where `$drop` is possibly changed due to
 restrictions has been moved to the top of the function, since otherwise it
 causes unexpected issues: It does that at the moment, when you call
 `wpmu_delete_blog()` for the main site with `$drop` set to true, the
 `delete_blog` filter will receive true although the value will actually be
 set to false afterwards. The change I made here fixes this. Other than
 that, the flow in `wpmu_delete_blog()` remains completely the same as
 before.

 I'd like to discuss whether we should introduce pre-filters for inserting,
 updating and deleting sites. Those would allow both short-circuiting, but
 also allow to perform actions ''before'' anything is changed. Furthermore,
 I deprecated `delete_blog` referring to `wp_delete_site` as replacement,
 however a `pre_wp_delete_site` filter would be a more accurate one.

 Another thing I'm asking myself is whether the `wp_insert_site` hook or
 `wp_initialize_site` hook should be run first.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/41333#comment:15>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list