• Resolved hungpqz

    (@hungpqz)


    When I use javascript to call API (using fetch) I saw CORS error. It happened when I activated JSON API Plugin, that is required.

    When I deactivate JSON API Plugin, no CORS error happen to whole site

Viewing 1 replies (of 1 total)
  • Plugin Author Ali Qureshi

    (@parorrey)

    function add_cors_http_header(){
        header("Access-Control-Allow-Origin: *");
    }
    add_action('init','add_cors_http_header');

    Add this code to your theme functions.php

    Or

    In the file located in wp-content/plugins/json-api/singletons/api.php, add following line:

        <? header("Access-Control-Allow-Origin: *"); ?>

Viewing 1 replies (of 1 total)
  • The topic ‘CORS error happen when activate JSON API Plugin, that is required’ is closed to new replies.