Loading GravityForms Outside of WordPress
I had a WordPress installation in
/blog/, but I needed a WordPress’s GravityForm to render
/contact.php an external non-WordPress php page. I could of coded a form myself, but there are so many advantages to using GravityForms.
contact.php in a perfect world, the following would work:
but it doesn’t — upon submission the page reloads with entered values in-tacked but no sucessful submission message or errors.
Looking in the first file in GravityForm plugin
gravityforms.php, there’s a ton of actions hooked into the
wp action. So by simply firing
wp, the GravityForm now works, outside of a WordPress installation.
wpfooter() which means style sheets, ajax submission and conditional logic won’t work. I also think loading WordPress this way neglects to run init, which several functions are hooks into, but I got what I needed out of simply: