enable_maintenance_mode
Это хук WordPress - enable_maintenance_mode. Плагин его просто использует.
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.
Использование
add_filter( 'enable_maintenance_mode', 'wp_kama_enable_maintenance_mode_filter', 10, 2 ); /** * Function for `enable_maintenance_mode` filter-hook. * * @param bool $enable_checks Whether to enable maintenance mode. * @param int $upgrading The timestamp set in the .maintenance file. * * @return bool */ function wp_kama_enable_maintenance_mode_filter( $enable_checks, $upgrading ){ // filter... return $enable_checks; }
- $enable_checks(true|false)
- Whether to enable maintenance mode.
По умолчанию: true - $upgrading(int)
- The timestamp set in the .maintenance file.
Список изменений
С версии 4.6.0 | Введена. |
Где вызывается хук
В файле: /php/wp-settings-cli.php
enable_maintenance_mode
wp-cli/php/wp-settings-cli.php 81
if ( apply_filters( 'enable_maintenance_mode', true, $upgrading ) ) {