Skip to content

Instantly share code, notes, and snippets.

@notjb
Last active September 9, 2024 07:54
Show Gist options
  • Save notjb/42a9a2d198d0c0100dd1425d35ccc0d1 to your computer and use it in GitHub Desktop.
Save notjb/42a9a2d198d0c0100dd1425d35ccc0d1 to your computer and use it in GitHub Desktop.
[WP] Contact Form 7 through Wordpress REST API

[WP] Contact Form 7 through Wordpress REST API

This article is a good basis: https://css-tricks.com/headless-form-submission-with-the-wordpress-rest-api/


You'll have to use the post_id of a form as <FORM_ID> for the api endpoints: https://your-site.tld/wp-json/contact-form-7/v1/contact-forms/<FORM_ID>/feedback

This unhashed-id is found in the URL of the editing page of a form: <SITE_URL>/wp-admin/admin.php?page=wpcf7&post=<UNHASHED_FORM_ID>&action=edit


The rest of the article should work 🤘


sources : https://www.timber-dev.net/how-to-submit-contact-form-7-via-api-with-headless-wordpress-using-html-and-vanilla-javascript/ https://contactform7.com/2015/03/28/custom-validation/ rocklobster-in/contact-form-7#1366 https://wordpress.org/support/topic/please-help-with-rest-api-not-work/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment