Open marianagarciaferreira opened 5 years ago
I was able to solve it like this:
I include the following lines at the top of the qtranslate.php file: ` header ('Access-Control-Allow-Origin: http: // localhost: 8080'); header ('Access-Control-Allow-Methods: GET'); header ('Access-Control-Allow-Credentials: true');
`
Does anyone know why I may be having color error when the qtranslate plugin is enabled?
Yesterday I thought I had solved it, but today it was a problem again.
Note qTranslate-X is abandoned since 2016 so you will hardly get some help here. But we have been reviving it as qTranslate-XT in this repo: https://github.com/qtranslate/qtranslate-xt
About CORS i have never had some problems but there were redirect issues with the REST API so this might be fixed if this is related.
When it is active erro Cors Access to fetch at 'http://api.local.lab/wp-json/wp/v2/slides?lang=pb' from origin 'http://localhost:8080' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
and when it deactivates the plugin does not occur cors error and cors back function normal.
my cors works perfect when deactivates the plugin add_action( 'rest_api_init', function () {
}, 15 );