WordPress filter hook
disable_wp_rest_api_error
Defined by Disable WP REST API and fired by 7 plugins in total, running on 138K+ sites between them.
How to use disable_wp_rest_api_error
It's a filter: your callback receives the value, and must return the (changed) value.
Add this to your theme's functions.php or a small custom plugin:
add_filter( 'disable_wp_rest_api_error', function( $attr__ ) {
// Change $attr__ here.
return $attr__;
}, 10, 1 );Argument names come from Patchstack's source. Other plugins may pass different values: check the call in the plugin you're targeting below.
7 plugins that fire disable_wp_rest_api_error
Sorted by active installs. Each entry shows where the plugin calls the hook and what it passes.
-
Patchstack100,000+ installs
apply_filters( 'disable_wp_rest_api_error', esc_attr__( 'The WP REST API cannot be accessed by unauthorized users.', 'disable-wp-rest-api' ) )includes/hardening.php:188 -
Disable WP REST API30,000+ installs
apply_filters( 'disable_wp_rest_api_error', __('REST API restricted to authenticated users.', 'disable-wp-rest-api') )disable-wp-rest-api.php:69 -
Maintenance Mode8,000+ installs
apply_filters( 'disable_wp_rest_api_error', __('REST API restricted to authenticated users.', 'hkdev-maintenance-mode') )hkdev-disable-rest-api.php:51 -
WPControl200+ installs
apply_filters( 'disable_wp_rest_api_error', __('REST API restricted to authenticated users.', 'wpcontrol') )includes/frontend/frontend.php:598 -
WP Basic Elements100+ installs
apply_filters( 'disable_wp_rest_api_error', esc_html__( 'REST API restricted to authenticated users.', 'wpbe' ) )classes/Optimization/Section/REST.php:48 -
SAPO Parceiro30+ installs
apply_filters( 'disable_wp_rest_api_error', __('Acesso restrito a utilizadores autenticados.', 'sapo_partner') )sapoparceiro.php:123 -
DozWPSecureFewer than 10 installs
apply_filters( 'disable_wp_rest_api_error', __('REST API restricted to authenticated users only.', 'disable-wp-rest-api') )DozWPSecure.php:389
Need a customisation built on this hook?
Tell us what you want to change and which plugin it's for. We'll write it, test it and send it back as a small plugin.