### Disable REST API for Non-Authenticated Users Source: https://wpadminify.com/docs/adminify/security/disable-rest-api Use this filter in your theme's functions.php file to restrict REST API access to logged-in users only. This serves as a manual alternative to the WP Adminify plugin. ```php add_filter('rest_authentication_errors', function ($result) { if (!is_user_logged_in()) { return new WP_Error('rest_disabled', 'REST API restricted to authenticated users.', ['status' => 403]); } return $result; }); ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.