Add this to your WordPress function.php file and you should be set!
Remember to update the text ‘yourfrontenddomain’ to the domain you are using on the front end.
Hopefully this solves your WordPress CORS issue!
https://robertmarshall.dev/blog/wordpress-rest-api-cors-issues/