🎉 Celebrate with 10% OFF on All Products! Use Code: GFEX10 Or Buy Any 2+ Items for 30% OFF with Code: GFEX30!

Gravity Forms Embed and URL Preview Premium Add-on Setup Guide

Updated 11 min read Gravity Forms Integrations A–Z
On this page
  1. What You Get
  2. Requirements
  3. Installation
  4. Add the Field
  5. Accepted Links
  6. Only accept links from one provider
  7. Addresses that are refused at once
  8. The Live Preview
  9. Privacy: Click to Load
  10. How the Server Gets the Preview
  11. The link card and the address guard
  12. Entries
  13. Notifications and Merge Tags
  14. AJAX, Multi-Page Forms and Save and Continue
  15. Phones and Accessibility
  16. Add-on Settings
  17. Developer Hooks
  18. Troubleshooting
  19. Frequently Asked Questions
  20. Does it use an outside proxy or a GravityExtra service?
  21. Does the visitor’s browser contact YouTube straight away?
  22. Can I accept only one provider?
  23. What happens when my license expires?
  24. Can the visitor embed anything they like on my site?
  25. Paste a link, see the preview

Embed and URL Preview adds one new field to Gravity Forms: Embed / URL Preview. A visitor pastes a link to a video, a song, a post or any web page, and the form shows a live preview under the field. The entry keeps the link, the title and the embed, so you see the video player or the link card when you open it, and your notifications show the link and the title. Everything runs on your own site: the preview is asked for by your server with WordPress core oEmbed, and no outside proxy is involved.

A Share your link form with a name field and an Embed field that holds a pasted video link, and under it a preview card with the video title, the line Nothing is loaded from YouTube until you click and a Load embed button
The visitor sees the title at once; the video loads only after the click.

What You Get

  • A link field with validation and a live preview under it.
  • You choose the accepted providers per field: YouTube, Vimeo, SoundCloud, Spotify, TikTok, X, Instagram, any other provider that WordPress oEmbed supports, and a generic link card for any page.
  • A required provider rule, for example only YouTube links.
  • A privacy option, click to load, which is on by default: the visitor’s browser makes no request to the provider until the visitor clicks.
  • Entries that show the embed, notifications that show the link and the title, and the merge tags for the link and the title.
  • A nonce, a rate limit and a cache on the preview route, and a guard against private and local addresses for the link card.
  • Works with AJAX forms, multi-page forms, save and continue and conditional logic.

Requirements

  • Gravity Forms 2.9 or newer (tested with 2.9 and 3.1), WordPress 6.5 or newer and PHP 7.4 or newer.
  • Your server must be able to make outgoing web requests, because the preview is fetched on the server.

Installation

  1. Install and activate the add-on in the usual way.
  2. Open Forms → Settings → Embed Field, enter your license key and activate it.
  3. Add the field to a form and choose the providers it accepts.

Add the Field

  1. Open the form in the editor and add Embed / URL Preview from the Advanced Fields group.
  2. Select the field. In the General tab you find the block Accepted links, the select Only accept links from and the option Click to load the embed.
  3. Save the form and open it on your site. Paste a link and the preview appears after a moment.

Tick the providers that visitors may paste. A new field accepts YouTube, Vimeo, SoundCloud, Spotify and the link card.

Choice What it covers
YouTube, Vimeo, SoundCloud, Spotify, TikTok, X, Instagram Links of that provider, including short addresses such as youtu.be. A match is made on the domain, so a look-alike address on another domain is not a match.
Other WordPress oEmbed providers Any provider that WordPress oEmbed knows, for example the providers in the WordPress core list or a provider your site added with wp_oembed_add_provider.
Link card (any page) Any web page. It is shown as a card with the title, a short description, the site name and a picture. It also catches links of a provider that is not ticked.

A link that is not accepted gets a clear message under the field, while the visitor types and again when the form is submitted. The check is repeated on the server, so it cannot be skipped by changing the page in the browser.

Choose a provider in Only accept links from, for example YouTube, and every other link is refused with the message Please paste a link from YouTube. This is the required provider rule. The provider you pick is ticked for you.

Addresses that are refused at once

A link must start with http or https. Addresses with a user name, addresses that point to the machine itself or to an inside network, such as localhost, a private number or a name that only works inside a company network, are refused as not a valid web address. A visitor who types only a domain and a path, like vimeo.com/123, gets https added.

The Live Preview

When a visitor pastes or types a link, the field waits a moment and then asks your site for the preview. The answer depends on the link.

Link What the visitor sees
A video or audio link from a provider that WordPress oEmbed knows A card with the title and a button. After the click the video or audio player appears in a sandboxed iframe.
A post that needs the provider’s own script, such as many social posts A card with the author and the text of the post. The script is never loaded.
Any other page, when the link card is ticked A card with the title, the description, the site name and, on request, the picture.
A page that cannot be read, a picture file or a missing page A short notice that no preview is available. The link is still accepted and saved.
The same form with a pasted web page: a link card with the page title, a short description, the site name and a Show picture button
Any page can become a link card, with the picture loaded on request.

While the answer is on its way the field shows a short Loading message in a polite live region, so screen readers announce the result. The load button is a normal button that works with the keyboard.

Privacy: Click to Load

Under the European data protection rules, an embedded video makes the visitor’s browser contact the provider as soon as the page shows it, which sends the visitor’s address and other data to a third party. With Click to load on, which is the default, nothing is requested from the provider or from the site of a picture until the visitor presses the button. The title and the description in the card come from your own server, so they cost the visitor no outside request.

The note under the button tells the visitor what happens: Nothing is loaded from the provider until you click. Switch the option off in the field if you want the embed and the picture to appear at once.

How the Server Gets the Preview

The browser never calls a provider. It calls a route of your own site, which checks four things before it does anything.

  1. A nonce made for this form and this field. A page that is cached for more than a day shows a short message that asks the visitor to reload; the form itself still works.
  2. The license, so the preview is only available while the add-on is activated.
  3. The settings of the field, so a link the field does not accept never gets a preview.
  4. A rate limit, 40 previews per visitor in 5 minutes by default. The visitor is counted by a hash of the address and the site key, never by the plain address.

For a provider link the server uses WordPress core oEmbed, which calls the endpoint of the provider with the link. Page discovery is switched off, so the server never fetches a page just to look for an oEmbed address. For every other link the server reads the page itself, as described next. Answers are cached for 12 hours by default, and a failed lookup for 10 minutes, so the same link is never looked up again and again.

Because a visitor controls the link, the server must never be tricked into calling an address inside your own network. The link card is read with these protections:

  • Only http and https, only the ports 80 and 443, and no user name in the address.
  • Names such as localhost, names that end in local, internal or lan, single-word names and addresses written as a number, in hex or in octal are refused.
  • The name is looked up first and every address it resolves to must be a public one. Private ranges (10.x, 172.16 to 31.x, 192.168.x), loopback (127.x and ::1), link-local and cloud metadata addresses (169.254.x), shared ranges, multicast and the IPv6 forms that carry an IPv4 address are all refused.
  • The request is pinned to the address that was checked, so an answer that changes between the check and the request does not help.
  • Redirects are followed by hand, at most three, and every step goes through the same checks again. A page that redirects to an inside address is refused.
  • The call uses wp_safe_remote_get, the WordPress function that refuses unsafe addresses as well, with a 5 second time limit and a 256 KB limit on what is read. Only the head of the page is used.
  • Text from a page is stripped of tags and cut to a sensible length. A picture address must start with http or https.

Entries

The entry keeps the link as its value, so searching, filtering and exports work on the link. The title, the provider and the embed data are saved next to it. In the entry detail the embed is shown in a sandboxed iframe with the title and the link, or as a card for ordinary pages. The iframe is rebuilt from clean data every time and passed through wp_kses, which keeps an iframe and nothing else: no scripts, no event handlers, no other tags.

A Gravity Forms entry in the admin that shows the embedded video player, its title and the link
The entry shows the embed, cleaned and sandboxed.

If you edit the link in the admin, the saved title and embed are refreshed. If you delete the entry, they are deleted with it.

Notifications and Merge Tags

An iframe cannot run in an e-mail, so a notification shows the title and the link. In all_fields you get the title in bold and the link under it. For more control use the merge tag of the field.

<p>New link from {Your name:1}</p>
<p>Link: {Embed:2:url}</p>
<p>Title: {Embed:2:title}</p>
<p>Provider: {Embed:2:provider}</p>
<p>{Embed:2:link}</p>
Merge tag Result
Embed:2:url The link. The tag without a modifier gives the same.
Embed:2:title The title of the video or page. When there is none, the name of the site.
Embed:2:provider The provider name, for example YouTube.
Embed:2:link The title as a link to the page.
Embed:2:embed The title and the link as markup (HTML notifications).

Replace Embed and 2 with the label and the id of your field. The title is read from the saved entry, so notifications that Gravity Forms sends in the background show it too.

AJAX, Multi-Page Forms and Save and Continue

  • AJAX forms: the preview starts again after a validation message or any other re-render of the form.
  • Multi-page forms: the link is kept when the visitor goes to another page and back, and the preview is shown again.
  • Save and continue: when a visitor resumes a saved form, the link is back in the field and the preview is loaded again.
  • Conditional logic: a hidden field saves nothing.

Phones and Accessibility

  • The card and the player fit the width of the screen, and the video keeps its proportions.
  • The load button is large enough to tap.
  • The result of a preview is announced through a polite live region and the embedded player has a title.

Add-on Settings

Setting What it does
Previews per visitor in 5 minutes The rate limit of the preview route. Default 40. Enter 0 to switch it off.
Keep a preview for (hours) How long an answer is cached. Default 12.

Developer Hooks

Filter What it changes
geef_rate_limit The number of previews per visitor in 5 minutes.
geef_cache_hours How many hours a preview is cached.
geef_client_config The data the field prints for its script (labels, privacy option, address of the route).
geef_fetch_bytes and geef_fetch_timeout The size limit and the time limit of the page fetch.
geef_client_ip How the visitor is identified for the rate limit, for sites behind a proxy.
geef_ssrf_ports The ports the link card may use. Default 80 and 443.
geef_ssrf_allowed_hosts A list of host names that skip the address guard. Empty by default; only add a host you fully trust.
// Allow 100 previews per visitor in 5 minutes on this site.
add_filter( 'geef_rate_limit', function () {
    return 100;
} );

Troubleshooting

Problem Check
No preview at all The license key must be active. Open the browser console for a message. If the page is cached for a long time, reload it: the preview route needs a fresh nonce.
A card appears but no video Click to load is on. Press the Load embed button, or switch the option off in the field.
A link from Instagram or another provider shows only a card Some providers only give an oEmbed answer to apps that have an access token. Without it the link is shown as a link card, which still has the title and the picture when the page shares them.
No preview is available The page may need a login, may block servers, or may not be HTML. The link is still saved.
Too many previews The visitor reached the rate limit. Raise it in the add-on settings or with geef_rate_limit.
The server cannot reach the provider Your host may block outgoing requests. Ask the host to allow outgoing web requests from PHP.

Frequently Asked Questions

Does it use an outside proxy or a GravityExtra service?

No. Your server asks the provider through WordPress core oEmbed, or reads the page itself. Nothing passes through a GravityExtra service.

Does the visitor’s browser contact YouTube straight away?

Not with Click to load, which is on by default. The provider is contacted after the click.

Can I accept only one provider?

Yes. Use the option Only accept links from.

What happens when my license expires?

The preview is not shown and the field prints no input. Your forms, entries and the data already saved stay as they are.

Can the visitor embed anything they like on my site?

No. Only the embed that the provider’s own oEmbed answer describes is shown, rebuilt as a sandboxed iframe from clean data, and only to you in the entry. Nothing a visitor pastes is printed as markup.

A live preview for videos, songs, posts and pages, with click to load for privacy and the embed saved in every entry.

Still need help?

Our support team answers tickets every day, usually within a few hours.

0
0
Your Cart
Your cart is emptyReturn to Shop
🔥 FREQUENTLY BOUGHT TOGETHER
Complete Combo & Save 40%!
ITEM IN YOUR CART
Gravity Forms Klaviyo Add-on
$39.00/yr
+
🎁 RECOMMENDED ADD-ON SAVE 40% OFF
Original Price: $39.00/yr
Bundle Special Price: $23.40/yr