Filter hook 'do_mu_upgrade'

in WP Core File wp-admin/admin.php at line 74

View Source

do_mu_upgrade

Filter Hook
Description
Filters whether to attempt to perform the multisite DB upgrade routine. In single site, the user would be redirected to wp-admin/upgrade.php. In multisite, the DB upgrade routine is automatically fired, but only when this filter returns true. If the network is 50 sites or less, it will run every time. Otherwise, it will throttle itself to reduce load.

Hook Information

File Location wp-admin/admin.php View on GitHub
Hook Type Filter
Line Number 74

Hook Parameters

Type Name Description
bool $do_mu_upgrade Whether to perform the Multisite upgrade routine. Default true.

Usage Examples

Basic Usage
<?php
// Hook into do_mu_upgrade
add_filter('do_mu_upgrade', 'my_custom_filter', 10, 1);

function my_custom_filter($do_mu_upgrade) {
    // Your custom filtering logic here
    return $do_mu_upgrade;
}

Source Code Context

wp-admin/admin.php:74 - How this hook is used in WordPress core
<?php
  69  	 *
  70  	 * @since MU (3.0.0)
  71  	 *
  72  	 * @param bool $do_mu_upgrade Whether to perform the Multisite upgrade routine. Default true.
  73  	 */
  74  	if ( apply_filters( 'do_mu_upgrade', true ) ) {
  75  		$c = get_blog_count();
  76  
  77  		/*
  78  		 * If there are 50 or fewer sites, run every time. Otherwise, throttle to reduce load:
  79  		 * attempt to do no more than threshold value, with some +/- allowed.

PHP Documentation

<?php
/**
	 * Filters whether to attempt to perform the multisite DB upgrade routine.
	 *
	 * In single site, the user would be redirected to wp-admin/upgrade.php.
	 * In multisite, the DB upgrade routine is automatically fired, but only
	 * when this filter returns true.
	 *
	 * If the network is 50 sites or less, it will run every time. Otherwise,
	 * it will throttle itself to reduce load.
	 *
	 * @since MU (3.0.0)
	 *
	 * @param bool $do_mu_upgrade Whether to perform the Multisite upgrade routine. Default true.
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 1
  • File: wp-admin/admin.php
Related Hooks

Related hooks will be displayed here in future updates.