Make WordPress Core

Opened 5 years ago

Closed 3 years ago

Last modified 3 years ago

#49612 closed defect (bug) (fixed)

wpmu_new_blog hook has been deprecated. Use wp_initialize_site instead.

Reported by: asaquzzaman's profile asaquzzaman Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: 6.0 Priority: normal
Severity: normal Version:
Component: Networks and Sites Keywords:
Focuses: multisite Cc:

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)

49612.diff (770 bytes) - added by asaquzzaman 5 years ago.

Download all attachments as: .zip

Change History (10)

@asaquzzaman
5 years ago

#1 @SergeyBiryukov
5 years ago

  • Component changed from General to Networks and Sites
  • Focuses multisite added

This ticket was mentioned in PR #187 on WordPress/wordpress-develop by asaquzzaman.


5 years ago
#2

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

#3 @SergeyBiryukov
4 years ago

Related/duplicate: #49349

#4 @MadtownLems
3 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)

#5 @SergeyBiryukov
3 years ago

  • Milestone changed from Awaiting Review to 6.0

#6 @SergeyBiryukov
3 years ago

  • Owner set to SergeyBiryukov
  • Resolution set to fixed
  • Status changed from new to closed

In 52816:

Networks and Sites: Suggest wp_initialize_site as an alternative for the deprecated wpmu_new_blog action.

The previously suggested alternative, wp_insert_site, does not get passed enough arguments and runs before the new site initialization routine is actually executed.

Follow-up to [43654].

Props asaquzzaman, henry.wright, MadtownLems.
Fixes #49612.

#8 @SergeyBiryukov
3 years ago

#49349 was marked as a duplicate.

#9 @SergeyBiryukov
3 years ago

In 52817:

Docs: Update the DocBlock for the wpmu_new_blog action to suggest wp_initialize_site as an alternative.

Follow-up to [43654], [52816].

See #49612.

Note: See TracTickets for help on using tickets.