DEV Community

Discussion on: Headless WordPress with React

Collapse
 
jchiatt profile image
J.C. Hiatt

Hey! From the Codex:

For developers making manual Ajax requests, the nonce will need to be passed with each request. The API uses nonces with the action set to wp_rest. These can then be passed to the API via the _wpnonce data parameter (either POST data or in the query for GET requests), or via the X-WP-Nonce header.

More here: developer.wordpress.org/rest-api/u...

Thread Thread
 
bennerge profile image
BennerGe

Yes I read that already, had already tested it and it works. But I wonder how I can pass the generated nonce from WP to my app, if it is completely independent from my Wordpress installation, e.g. the app is in a different directory / subdomain as Wordpress.

Thread Thread
 
jchiatt profile image
J.C. Hiatt

That's a good question! I'll look into that and see if I can write a post on it.

—J