rest_enabled
Устарел с версии 4.7.0. Больше не поддерживается и может быть удален. Смотрите rest_authentication_errors.
Filters whether the REST API is enabled.
Использование
add_filter( 'rest_enabled', 'wp_kama_rest_enabled_filter', 10, 3 );
/**
* Function for `rest_enabled` filter-hook.
*
* @param bool $rest_enabled Whether the REST API is enabled.
* @param $string
* @param $sprintf
*
* @return bool
*/
function wp_kama_rest_enabled_filter( $rest_enabled, $string, $sprintf ){
// filter...
return $rest_enabled;
}
- $rest_enabled(true|false)
- Whether the REST API is enabled.
По умолчанию: true - $string
- -
- $sprintf
- -
Список изменений
| С версии 4.4.0 | Введена. |
| Устарела с 4.7.0 | Use the {@see 'rest_authentication_errors'} filter to |
Где вызывается хук
rest_enabled
wp-includes/rest-api/class-wp-rest-server.php 342-352
apply_filters_deprecated( 'rest_enabled', array( true ), '4.7.0', 'rest_authentication_errors', sprintf( /* translators: %s: rest_authentication_errors */ __( 'The REST API can no longer be completely disabled, the %s filter can be used to restrict access to the API, instead.' ), 'rest_authentication_errors' ) );