How to require files in a custom endpoint
From the wp_die() reference, $args (string|array|int) (Optional) Arguments to control behavior. If $args is an integer, then it is treated as the response code. ‘response‘ (int) The HTTP response code. Default 200 for Ajax requests, 500 otherwise. So your REST API endpoint returns the error 500 because that’s the default header status sent by the … Read more