Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the ad-inserter domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /var/www/vhosts/blog.webeats.it/httpdocs/wp-includes/functions.php on line 6114

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the cookie-law-info domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /var/www/vhosts/blog.webeats.it/httpdocs/wp-includes/functions.php on line 6114

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the wordpress-seo domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /var/www/vhosts/blog.webeats.it/httpdocs/wp-includes/functions.php on line 6114
Abilitare CORS sulle JSON API di WordPress - Blog WebEats

Come abilitare il Cross-Origin Resource Sharing – CORS sulle API JSON di WordPress per permettere il cross domain

CORS?

Talvolta è necessario ricevere delle informazioni dal Server A al Server B o ad n clients (ad esempio tramite JavaScript), ecco che interviene CORS che stabilisce delle regole per “decidere” a chi fornire la risposta e a chi no.

Dopo aver installato il plug-in al nostro WordPress, è necessario aggiungere una riga al file api.php.

Il modo più semplice è di modificare il file wp-content/plugins/json-api/singletons/api.php tramite editor (integrato in WordPress) e aggiungere all’inizio una semplice riga:
header("Access-Control-Allow-Origin: *");

Semplice no?