Steven Henty

Developer

  • Facebook
  • LinkedIn
  • Twitter
  • Blog
  • Profile
  • Products
  • Contact
© 2023 Steven Henty

Add Gravity Forms to the WordPress Dashboard

February 12, 2015 by Steven Henty 13 Comments

With the release of Gravity Forms 1.9 it’s now possible to display forms anywhere in WordPress admin. Here’s an example of how to add a Gravity Form to the dashboard like this:

gravityforms-dashboard2

A Gravity Form in the WordPress dashbord


Here’s the code:

Filed Under: Gravity Forms

Comments

  1. Jeremy says

    February 25, 2015 at 5:33 pm

    Thanks Steven,

    Great tutorials and you are truly saving my skin when it comes to extending GF.

    Reply
    • Steven Henty says

      July 7, 2015 at 10:30 pm

      Thank you for your feedback Jeremy – I really appreciate it.

      Reply
  2. Peter Harris says

    July 7, 2015 at 10:10 pm

    The dudes over at GF told me about this… does it go in one’s function file? I tried adding it to a template for a different plugin and it didn’t work. (FYI, I’m using it on a multisite installation, so not sure if the functions file approach would work.)

    Reply
    • Steven Henty says

      July 7, 2015 at 10:29 pm

      Yes, it works fine on multisite. Remember forms are site-specific so if you add it to your functions.php file you may want to check the current site first. Something like this: $current_site = get_current_site();
      if ( $current_site->domain == ‘mysite.com’ ) {
      add_action( ‘wp_dashboard_setup’, ‘sh_dashboard_setup’ );
      }

      Reply
      • Peter Harris says

        July 7, 2015 at 10:40 pm

        Oh right, DUH. I’m trying to load in a form from the main site into a sub-site. Not gunna work. So thinking I’ll try to load in via an iframe or some such. Thanks for clarifying this!

        Reply
        • Steven Henty says

          July 7, 2015 at 10:49 pm

          You might be able to use switch_to_blog($site_id) and restore_current_blog(). https://codex.wordpress.org/WPMU_Functions/switch_to_blog

          Reply
          • Peter Harris says

            July 7, 2015 at 10:58 pm

            Still trying to drop into a theme for a plugin and its not working. I know you said it goes in the functions file, but I need it to appear only within that plugin theme template, not the actual dashboard, so maybe this isn’t the approach for me? Sorry, bit ig’nant when it comes to these things… 🙁

          • Steven Henty says

            July 7, 2015 at 11:03 pm

            That’s right this is just for displaying the form in the admin dashboard.

  3. Oscar Ramiro says

    July 14, 2015 at 10:54 am

    Hi Steven, congratulations for your outstanding blog.

    How do we develop a form like the one you include in this post?
    That is, a “summary” form (not a submission one) containing the % of choice per field options (and counts of them) of a form.

    Thanks.
    OSCAR

    Reply
  4. Doug LaMunyon says

    August 31, 2015 at 4:44 pm

    Thanks for this post. We are building this into a client’s site so that their employees can login and have custom internal contact forms for human resources. I appreciate you sharing.

    Reply
    • Steven Henty says

      August 31, 2015 at 8:35 pm

      Thanks for the feedback Doug – I really appreciate it. You may want to check out my new plugin Gravity Flow for the processes.

      Reply
  5. danny says

    January 15, 2016 at 7:57 pm

    This works real well.. I have one form inserted in the admin area.
    My question is how can I add 2 forms? Or even 3..
    I tried a few different things but I get errors..
    Thanks for nay help
    Danny

    Reply

Trackbacks

  1. Load Gravity Forms via AJAX - Steven Henty says:
    June 1, 2015 at 10:03 pm

    […] you read my post last week, which demonstrates how to display Gravity Forms in WordPress admin pages, it may have got you […]

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *