wp_maybe_transition_site_statuses_on_update( WP_Site $new_site, WP_Site|null $old_site = null )
- Since
- 5.1.0
- Source
wp-includes/ms-site.php:1145
Compatibility
- WordPress
- since 5.1.0
- PHP
- 7.4–8.6-dev
- 6.7.7
- 6.8.8
- 6.9.7
- 7.0.4
- 7.1.0
Present in every tracked release (6.7.7 to 7.1.0), and compiles on PHP 7.4 through 8.6-dev.
Parameters
$new_siteWP_Site- The site object after the update.
$old_siteWP_Site|nulloptional- If $new_site has been updated, this must be the previous state of that site. Default null.Default:
null
Performance profile
How much work a call to wp_maybe_transition_site_statuses_on_update() does, and what it touches: the algorithmic scaling, the Zend instruction count per call across PHP versions, the hooks it hands control to, and the core code that calls it. Measured from the compiled opcodes, not a stopwatch, so every number is identical on any machine running the same PHP version, and every function in core is ranked by cost.
- Cost class
- Trivial
- Scaling
- Constant
- Instructions
- 25–70
- Plugin surface
- 9 hooks
- Called by
- 0
Touches nothing outside its own arguments.
No loop in the body: the same number of instructions runs whatever you pass in.
Executed per call on PHP 8.5, depending on the branch taken. The body compiles to 86.
Third-party callbacks on 'make_spam_blog', 'make_ham_blog', 'mature_blog' run inside this call, and their cost is not bounded by anything here.
Nothing in core calls this; the cost is only what you spend yourself.
What it touches
- hookthird-party callbacks
do_action()called directly
What one call costs · 6 distinct outcomes
One number would be a lie: the work depends on which branch runs. These are every distinct cost wp_maybe_transition_site_statuses_on_update() can have, taken from its control-flow graph on PHP 8.5.
| When | Instructions | Calls it makes |
|---|---|---|
| always | 25–31 | none |
| always | 32–39 | do_action() |
| always | 39–47 | do_action(), do_action() |
| always | 46–55 | do_action(), do_action(), do_action() |
| always | 53–63 | do_action(), do_action(), do_action(), do_action() |
| always | 60–70 | do_action(), do_action(), do_action(), do_action(), do_action() |
Across PHP versions
Compiles the same on PHP 7.4, 8.1, 8.2, 8.3, 8.4, 8.5 and 8.6-dev: 86 instructions, 25–70 executed per call, 10 branches. The work does not change between versions.
An instruction is not a fixed amount of time, so a matching count is not necessarily the same speed; what it rules out is a difference in the work itself.
Hooks and filters fired · 9
9 hooks fire while wp_maybe_transition_site_statuses_on_update() runs, in this order:
- do_action( make_spam_blog )actionline 1163 (+18 into the body)
Fires when the 'spam' status is added to a site.
- do_action( make_ham_blog )actionline 1173 (+28 into the body)
Fires when the 'spam' status is removed from a site.
- do_action( mature_blog )actionline 1187 (+42 into the body)
Fires when the 'mature' status is added to a site.
- do_action( unmature_blog )actionline 1197 (+52 into the body)
Fires when the 'mature' status is removed from a site.
- do_action( archive_blog )actionline 1211 (+66 into the body)
Fires when the 'archived' status is added to a site.
- do_action( unarchive_blog )actionline 1221 (+76 into the body)
Fires when the 'archived' status is removed from a site.
- do_action( make_delete_blog )actionline 1235 (+90 into the body)
Fires when the 'deleted' status is added to a site.
- do_action( make_undelete_blog )actionline 1245 (+100 into the body)
Fires when the 'deleted' status is removed from a site.
- do_action( update_blog_public )actionline 1260 (+115 into the body)
Fires after the current blog's 'public' setting is updated.
Uses · 3
- do_action()Calls the callback functions that have been added to an action hook.
- WP_Site::__construct()Creates a new WP_Site object.
- stdClass::__construct()
Source code
function wp_maybe_transition_site_statuses_on_update( $new_site, $old_site = null ) { $site_id = $new_site->id; // Use the default values for a site if no previous state is given. if ( ! $old_site ) { $old_site = new WP_Site( new stdClass() ); } if ( $new_site->spam !== $old_site->spam ) { if ( '1' === $new_site->spam ) { /** * Fires when the 'spam' status is added to a site. * * @since MU (3.0.0) * * @param int $site_id Site ID. */ do_action( 'make_spam_blog', $site_id ); } else { /** * Fires when the 'spam' status is removed from a site. * * @since MU (3.0.0) * * @param int $site_id Site ID. */ do_action( 'make_ham_blog', $site_id ); } } if ( $new_site->mature !== $old_site->mature ) { if ( '1' === $new_site->mature ) { /** * Fires when the 'mature' status is added to a site. * * @since 3.1.0 * * @param int $site_id Site ID. */ do_action( 'mature_blog', $site_id ); } else { /** * Fires when the 'mature' status is removed from a site. * * @since 3.1.0 * * @param int $site_id Site ID. */ do_action( 'unmature_blog', $site_id ); } } if ( $new_site->archived !== $old_site->archived ) { if ( '1' === $new_site->archived ) { /** * Fires when the 'archived' status is added to a site. * * @since MU (3.0.0) * * @param int $site_id Site ID. */ do_action( 'archive_blog', $site_id ); } else { /** * Fires when the 'archived' status is removed from a site. * * @since MU (3.0.0) * * @param int $site_id Site ID. */ do_action( 'unarchive_blog', $site_id ); } }Changelog
Introduced in 5.1.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
About this page
- Parsed data
- Generated from the wordpress-develop 6.7.7 tag, from
src/wp-includes/ms-site.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it. - Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.