Hi @arnoldwillems
I hope you are doing well.
I am afraid we don’t have this option, I found this was requested in the past by our developers and I added this ticket as an extra request letting our developers know you are also looking for it.
However, to disable the Rest API you can use this filter:
<?php
add_filter( 'rest_authentication_errors', 'wp_snippet_disable_rest_api' );
function wp_snippet_disable_rest_api( $access ) {
return new WP_Error( 'rest_disabled', __('The WordPress REST API has been disabled.'), array( 'status' => rest_authorization_required_code()));
}
?>
Since Rest API is used by Gutenberg I suggest adding some extra validation to prevent issues with WP editor or other plugins.
https://gist.github.com/danielbachhuber/8f92af4c6a8db784771c
You can apply it as a mu-plugin https://wpmudev.com/blog/wordpress-mu-plugins/
Best Regards
Patrick Freitas