WordPress Jetpack contact forms
May 05, 2016 • 1 min read
EDIT, May 9, 2016
I noticed that the form wouldn’t submit when not logged in, so I’ve updated the gist to include a check to see if a user is logged in.
Jetpack is awesome for a lot of things. Unfortunately, one of the things that it isn’t so great for is submitting it’s contact form via AJAX. I’ve looked into this before and decided I might as well hack something together that ‘kind of works’ ™.
Here’s the full working code, I’ll go into a bit below:
Basically, all you do is fake-send the form via ajax, parse the returned page’s HTML and look for an H3 tag with the submission message.Easy-peasy…