The Ultimate Guide to Gravity Forms Shortcodes 2025

Last updated February 26, 2025
Gravity Forms shortcodes
If you’re using WordPress, chances are you’ve heard of Gravity Forms—one of the most powerful form builder plugins available. It’s flexible, user-friendly and packed with features that make creating forms a breeze. But what truly sets Gravity Forms apart is its use of shortcodes. Shortcodes allow you to embed forms anywhere on your website without touching a single line of code. Want to display a form in a blog post? Done. Need to pre-fill fields dynamically? Easy. In this guide, we’ll explore everything you need to know about Gravity Forms shortcodes, from basic usage to advanced techniques.

What Are Gravity Forms Shortcodes?

Shortcodes in WordPress are simple snippets of text enclosed in square brackets (e.g.,[gravityform]). These snippets act as placeholders that tell WordPress to render a specific element—in this case, a Gravity Form. Instead of manually inserting a form’s HTML code, you can use a shortcode to place the form anywhere on your site.

Why Use Shortcodes in Gravity Forms?

Flexibility – You can insert forms anywhere, including posts, pages, widgets, and custom post types.
Customisation – Shortcodes let you tweak form settings without modifying the form itself.
Dynamic Behaviour – You can pre-populate fields, control visibility, and even track submissions.

Shortcodes make Gravity Forms more powerful and versatile, helping you streamline your workflow.

Getting Started with Gravity Forms Shortcodes

Installing and Activating Gravity Forms

Before using shortcodes, you need to install and activate the Gravity Forms plugin. Since it’s a premium plugin, you’ll need a valid licence. Once installed, create a form from Forms > Add New in your WordPress dashboard.

Understanding Shortcode Syntax

The most commonly used shortcode format in Gravity Forms is:

html

[gravityform id="1"]
Here’s a breakdown:
  • id="1" – Specifies the form ID (change this to match your form).
Additional attributes that are commonly used include:
  • title="false" – Hides the form title.
  • description="false" – Hides the form description.
  • ajax="true" – Enables AJAX to submit the form without page reload.

Where to Place Gravity Forms Shortcodes in WordPress

You can insert Gravity Forms shortcodes almost anywhere in WordPress:

📌 Posts & Pages – Simply paste the shortcode into the content editor.
📌 Widgets – Add a shortcode in a text widget.
📌 Custom Templates – Use shortcodes inside theme files via PHP

Common Gravity Forms Shortcodes and Their Uses

Embedding a Basic Form

To display a form, use:

html

[gravityform id="2"]
Just replace the ID with your actual form’s ID, and the form will appear on the page.

Pre-Populating Form Fields

Using Query Strings for Pre-Population

Want to fill in form fields automatically? Add values to the URL:

url

https://yourwebsite.com/form-page/?name=John&[email protected]

Or, modify the shortcode like this:

html

[gravityform id="3" field_values="name=John&[email protected]"]

Dynamic Population via Hooks and Filters

For advanced users, Gravity Forms provides filters that allow dynamic population via PHP. For example:

php

add_filter('gform_field_value_name', function() { return 'John Doe'; });
This pre-fills the “name” field with John Doe.

Customising Form Display with Parameters

Hiding the Title and Description

If you don’t want the form title and description to appear, use:

html

[gravityform id="4" title="false" description="false"]

Enabling AJAX for a Seamless User Experience

Want to submit forms without reloading the page? Enable AJAX:

html

[gravityform id="5" ajax="true"]

Setting the Form’s Default Tab Index

To control the order in which fields are selected when users press “Tab”:

html

[gravityform id="6" tabindex="10"]

Advanced Gravity Forms Shortcode Techniques

Displaying Form Entries with Shortcodes

Gravity Forms allows you to display submitted form entries using third-party plugins like GravityView:

html

[gravityview id="7"]

Conditional Shortcodes for Form Visibility

You can hide or show forms based on user roles or conditions using conditional shortcodes like:

html

[gravityform id="8" visibility="logged_in"]
This makes the form visible only to logged-in users.

Embedding Forms Within Other Content Types

Shortcodes work inside custom post types, WooCommerce pages, and even pop-ups, making them incredibly versatile.

Troubleshooting Gravity Forms Shortcodes

Common Issues and How to Fix Them

⚠️ Shortcode Displays as Plain Text – Make sure you’re using the correct format.
⚠️ Form Not Appearing – Check that the form ID is correct.
⚠️ AJAX Not Working – Ensure your theme or plugins aren’t blocking AJAX requests.

Shortcodes Not Working? Here’s What to Check

  • Ensure Gravity Forms is Installed and Activated.
  • Test on a Default WordPress Theme to rule out theme conflicts.
  • Disable Other Plugins to check for compatibility issues.

Best Practices for Using Gravity Forms Shortcodes

Keeping Shortcodes Organised and Maintainable

If you’re using multiple shortcodes, document them within your content to keep track of their functions.

Optimising Forms for SEO and Performance

  • Enable AJAX to improve form submission speed.
  • Minimise unnecessary fields to reduce load times.

Ensuring Compatibility with Themes and Plugins

After updating your theme or plugins, test your forms to ensure they still function correctly.

Conclusion

Gravity Forms shortcodes make it effortless to embed and customise forms within WordPress. Whether you’re a beginner looking for a simple form solution or an advanced user aiming for dynamic field population, mastering these shortcodes will enhance your form-building capabilities.

Now that you’ve got the shortcode magic in your hands, go ahead and optimise your forms like a pro! 🚀

Frequently asked questions

Yes! Simply paste the shortcode into an Elementor Shortcode Widget, and the form will appear.

Go to Forms > All Forms in your WordPress dashboard. The ID is listed next to each form.

Absolutely! Just make sure each form has a unique ID to prevent conflicts.

Yes, but if you experience issues, exclude form pages from caching to ensure proper functionality.

Yes, but you’ll need GravityView or a custom plugin to display form entries dynamically.

Get your personal website development team and send them unlimited website tasks for just $119

Learn more

Related Stories

Gravity Forms WooCommerce
March 21, 2025

Gravity Forms WooCommerce – The Ultimate Guide

In this guide, we’ll take you through everything you need to know about using Gravity Forms with WooCommerce

Create WordPress child theme
July 26, 2021

What is a WordPress child theme and why do you need it?

A WordPress child theme is essential when you want to start customising your website. So what is a child theme? and how and why do you need it?

PSD to WordPress
September 26, 2023

PSD to WordPress: A Step-by-Step Guide for Beginners

Learn how to convert a PSD design into a well-organised and visually appealing WordPress website with this step-by-step guide.

Arrow-up