This question may be old, but building React applications on WordPress "facelessly" using the WP REST API is gaining momentum in a huge way (it's even the future for WordPress core), so this is bound to come up more and more.
So what is happening is that Gravity Forms sets it's form action by via $action = remove_query_arg( 'gf_token' );
which in turn calls add_query_arg()
which then calls $uri = $_SERVER['REQUEST_URI'];
- this means that when you use React to display WordPress content containing a Gravity Form, the form's action is set to the REST endpoint called, not the content's permalink. Whoops!
Although Gravity Forms has an bona-fide WP REST API add-on in works, there are two solid options I've been able to suss out so far:
Ensure you have a REST route that accepts POST (I suggest just reusing a GET route) and add do_action('wp');
to your route callback. You could add it earlier if you like, like the rest_api_init
hook. This will ensure that Gravity Forms gets