wp-pwa / wp-plugin

Old Frontity plugin. For the new one please visit https://github.com/frontity.
https://frontity.org
GNU General Public License v3.0
2 stars 1 forks source link

[0] Add CORS headers for updates #70

Closed luisherranz closed 5 years ago

luisherranz commented 5 years ago

In order to be able to update WP from an external site (useful for scripts) we need to modify the CORS headers sent by the RESP API. These are:

function allow_origin() {
    if (!headers_sent()) {
        header("Access-Control-Allow-Origin: *");
        header('Access-Control-Allow-Methods: POST, GET, OPTIONS, PUT, DELETE');
        header("Access-Control-Allow-Headers: Content-Type, Access-Control-Allow-Headers, Authorization, X-Requested-With");
        }
}

add_action('rest_pre_serve_request', array($this,'allow_origin'));
luisherranz commented 5 years ago

@orballo remember to add the "close x" with this issue in your commit.

frontibotito commented 5 years ago

:tada: This issue has been resolved in version 1.13.0 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket: