CORS Policy Error When Accessing Custom API from External Domain
-
Hello Team,
In WordPress, I created a custom API function with an API key for posts, categories, and authors. This API is working fine on my domain; it has been successfully integrated, and the posts are displayed. However, when I try to integrate it on another domain, it throws an error. For example:
Access to XMLHttpRequest at 'https://wordpress-website/wp-json/custom-post-api/v1/postslist/' from origin 'https://www.w3schools.com/' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
Please help me resolve this issue.
- You must be logged in to reply to this topic.