rest_enabled
Deprecated since 4.7.0. It is no longer supported and may be removed in future releases. See rest_authentication_errors.
Filters whether the REST API is enabled.
Usage
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.
Default: true - $string
- -
- $sprintf
- -
Changelog
| Since 4.4.0 | Introduced. |
| Deprecated since 4.7.0 | Use the {@see 'rest_authentication_errors'} filter to |
Where the hook is called
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' ) );