Shortening the displayed URL in a Website field

If your entries have long URLs, they can look bad when displayed in a View. GravityView offers a Website field option named "Shorten Link Display," which allows you to change a long, ugly URL to a nice-looking one.

  • It will take this:
  • And turn it into this:

The "Shorten Link Display" functionality is enabled by default for Gravity Forms Website fields in a View.

Here's how to enable and disable the functionality:

Click the Add Field button

Select a Website field from the field picker

If your form doesn't have a website field, this functionality will not be available.

Click the gear icon to configure the Field settings

Check or uncheck the "Shorten Link Display" setting

By default, links will be shortened by removing:

  • http:// and https://  ( => )
  • www. subdomain, if exists ( => )
  • Subdomains, if exists ( => )
  • URL paths ( => )
  • Query parameters ( => )

The link text will look shorter, but the link URL remains the same.

For developers: Hooks to modify the "Shorten Link Display" behavior

If you would like to tweak how the Shorten Link Display functionality works, there are hooks for that!

You can find the hooks inside the gravityview_format_link() function. You can also override the function by defining it in your theme's code>functions.php file.

The following hooks are available to modify functionality. All filters have a true default.

  • http:// and https:// (or any other scheme, like ftp://)  ( => )
    Filter: gravityview_anchor_text_striphttp
  • www. subdomain, if exists ( => )
    Filter: gravityview_anchor_text_stripwww
  • Subdomains, if exists ( => )
    Filter: gravityview_anchor_text_nosubdomain
  • URL paths ( => )
    Filter: gravityview_anchor_text_rootonly
  • Query parameters ( => )
    Filter: gravityview_anchor_text_noquerystring

See a code sample for disabling Shorten Link Display filters.

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us