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.

in 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.

I’m neglecting wphead() and 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:


  1. I can’t tell you how grateful I am for this! Been searching for hours. I was trying to load Gravity Forms in a custom PHP using wp-load.php. I knew exactly what the issue was but not the fix. do_action(‘wp’); solved it 🙂

    You da man!

Leave a Reply