Filter hook 'enable_maintenance_mode'

in WP Core File wp-includes/load.php at line 471

View Source

enable_maintenance_mode

Filter Hook
Description
Filters whether to enable maintenance mode. This filter runs before it can be used by plugins. It is designed for non-web runtimes. If this filter returns true, maintenance mode will be active and the request will end. If false, the request will be allowed to continue processing even if maintenance mode should be active.

Hook Information

File Location wp-includes/load.php View on GitHub
Hook Type Filter
Line Number 471

Hook Parameters

Type Name Description
bool $enable_checks Whether to enable maintenance mode. Default true.
int $upgrading The timestamp set in the .maintenance file.

Usage Examples

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

function my_custom_filter($enable_checks, $upgrading) {
    // Your custom filtering logic here
    return $enable_checks;
}

Source Code Context

wp-includes/load.php:471 - How this hook is used in WordPress core
<?php
 466  	 * @since 4.6.0
 467  	 *
 468  	 * @param bool $enable_checks Whether to enable maintenance mode. Default true.
 469  	 * @param int  $upgrading     The timestamp set in the .maintenance file.
 470  	 */
 471  	if ( ! apply_filters( 'enable_maintenance_mode', true, $upgrading ) ) {
 472  		return false;
 473  	}
 474  
 475  	return true;
 476  }

PHP Documentation

<?php
/**
	 * Filters whether to enable maintenance mode.
	 *
	 * This filter runs before it can be used by plugins. It is designed for
	 * non-web runtimes. If this filter returns true, maintenance mode will be
	 * active and the request will end. If false, the request will be allowed to
	 * continue processing even if maintenance mode should be active.
	 *
	 * @since 4.6.0
	 *
	 * @param bool $enable_checks Whether to enable maintenance mode. Default true.
	 * @param int  $upgrading     The timestamp set in the .maintenance file.
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 2
  • File: wp-includes/load.php
Related Hooks

Related hooks will be displayed here in future updates.