#49612 closed defect (bug) (fixed)
wpmu_new_blog hook has been deprecated. Use wp_initialize_site instead.
| Reported by: | asaquzzaman | Owned by: | SergeyBiryukov |
|---|---|---|---|
| Priority: | normal | Milestone: | 6.0 |
| Component: | Networks and Sites | Version: | |
| Severity: | normal | Keywords: | |
| Cc: | Focuses: | multisite |
Description
Please use this hook wp_initialize_site instead of wp_insert_site on deprecated message. Because if we use wp_insert_site hook, we couldn’t access wp_options table for newly created sites eg: updating option table data with update_options with error message:
WordPress database error Table 'ex.wp_10_options' doesn't exist for query SELECT autoload FROM wp_10_options WHERE option_name = 'ex_version' made by wpmu_create_blog, wp_insert_site, do_action('wp_insert_site')
Attachments (1)
Change History (10)
This ticket was mentioned in PR #187 on WordPress/wordpress-develop by asaquzzaman.
7 years ago
#2
#4
@
5 years ago
I've been cleaning up old plugins of wpmu_new_blog, and came here to make this exact request. Suggesting wp_insert_site is NOT a good replacement. The suggestion should absolutely be wp_initialize_site instead! (or at least mention both and let people see which makes sense for their specific case)
SergeyBiryukov commented on PR #187:
5 years ago
#7
Thanks for the PR! Merged in https://core.trac.wordpress.org/changeset/52816.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Please use this hook wp_initialize_site instead of wp_insert_site on deprecated message. Because if we use wp_insert_site hook, we couldn’t access wp_options table for newly created sites eg: updating option table data with update_options with error message:
WordPress database error Table 'ex.wp_10_options' doesn't exist for query SELECT autoload FROM wp_10_options WHERE option_name = 'ex_version' made by wpmu_create_blog, wp_insert_site, do_action('wp_insert_site')
Trac ticket: https://core.trac.wordpress.org/ticket/49612