WordPress.org

Make WordPress Core

Opened 3 years ago

Last modified 3 years ago

#38699 closed task (blessed)

Site count incorrect when using wpmu_create_blog() from a different network — at Initial Version

Reported by: johnjamesjacoby Owned by:
Milestone: 4.8 Priority: normal
Severity: normal Version: 3.0
Component: Networks and Sites Keywords: has-patch has-unit-tests
Focuses: multisite Cc:
PR Number:

Description

When using wpmu_create_blog() to create a site on a network ID other than the current, both networks end up with incorrect site counts. The current network gets +1, the other network ID remains the same.

In the event this site is the first site in a new network, no site or user counts are saved in wp_sitemeta.

This is because of a fleet of functions that do not accept a network ID a a parameter. It's also due to a lack of a network "switching" API to flip the $current_site global around when calling them.

The following functions lack proper Network attribution:

  • wp_maybe_update_network_site_counts()
  • wp_maybe_update_network_user_counts()
  • wp_update_network_counts()
  • wp_update_network_user_counts()
  • wp_update_network_site_counts()

See: #37538.

Change History (0)

Note: See TracTickets for help on using tickets.