WordPress.org

Make WordPress Core

Opened 2 years ago

Last modified 2 years ago

#46072 new enhancement

add a $metas param to wpmu_create_blog()

Reported by: pbiron Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Networks and Sites Keywords: has-patch
Focuses: multisite Cc:

Description

wpmu_create_blog() should accept an additional param for blogmeta for the new blog, analogous to the existing $options param for site options.

Attachments (1)

46072.diff (1.7 KB) - added by pbiron 2 years ago.
proof-of-concept patch for adding $metas param to wpmu_create_blog().

Download all attachments as: .zip

Change History (5)

@pbiron
2 years ago

proof-of-concept patch for adding $metas param to wpmu_create_blog().

#1 @pbiron
2 years ago

46072.diff is just a proof-of-concept, and is far from ready to be merged.

It sets things up correctly for the wp_initialize_site hook. But I haven't yet investigated all of the other places in core, and/or all the other hooks that are fired on blog creation, that might be affected by the change. I will certainly do that, and update the patch accordingly, if the general idea is accepted.

A few questions:

  1. While it makes more sense "logically" to have the new param right after the $options param, I've added it at the end of the param list, so that existing code expecting the optional $network_id param in that place are not affected. Do folks agree that is the right thing to do?
  2. Should the new param be passed to the deprecated wpmu_new_blog hook (in wp_insert_site())? My sense is no, but I thought I'd ask.

#2 @pento
2 years ago

  • Version trunk deleted

#3 @spacedmonkey
2 years ago

  • Keywords has-patch added

Thanks for your patch.

I am finding it hard to understand why we would want to make this change. Going forward we want developers to use wp_insert_site and we may end up deprecate wpmu_create_blog all together.

@pbiron Can you provide more detail on why developers wouldn't use wp_insert_site instead?

#4 @pbiron
2 years ago

Thanx for the question. I actually meant to ask about that in my previous comment.

In the 5.1 betas, /wp-admin/network/site-new.php still uses wpmu_create_blog() so I figured it was still the sanctioned way to create new sites and wondered why it wasn't rewritten to call wp_insert_site() directly along with all the other changes included in 5.1.

If plugins are now supposed to call wp_insert_site() directly, then by all means you can close this ticket.

p.s. it would be really helpful to get dev note(s) about all the 5.1 multisite changes sooner rather than later :-)

Note: See TracTickets for help on using tickets.