add_filter('rest_api_init', 'rest_only_for_authorized_users', 99);
function rest_only_for_authorized_users($wp_rest_server)
{
if (!is_user_logged_in()) {
wp_die('REST API is blocked', 'Access denied', 403);
}
}
add_filter('rest_api_init', 'rest_only_for_authorized_users', 99);
function rest_only_for_authorized_users($wp_rest_server)
{
if (!is_user_logged_in()) {
wp_die('REST API is blocked', 'Access denied', 403);
}
}