Documentation

gwp_url

The gwp_url Merge Tag for Gravity Forms is able to return the WordPress site url, the WordPress home url, the current url, or an element of the current url.

The gwp_url merge tag has the following possible parameters:

Type parameter

The type parameter determines what url component to return. It has the following possible values:

site_url: returns the URL for the current site where WordPress application files are accessible.

home_url: Retrieves the URL for the current site where the front end is accessible (basically what users need to type in their browser url to reach your site.

scheme: returns http or https.

domain: returns the full domain or a part of it if combined with the index parameter.

path: returns the full path after domain, or a part of it when combined with the index paramater.

Index parameter

The index parameter is an optional parameter to retrieve a part of the URL-path or domain. It must be an integer value. A positive value returns the element counted from the left, starting with 0. A negative value returns the element counted from the right.

How to use the gwp_url merge tag

{gwp_url type= index=}
ExamplesOutput
{gwp_url}https://gravitywp.com/doc/gwp_url/
{gwp_url type=site_url}https://gravitywp.com
{gwp_url type=home_url}https://gravitywp.com
{gwp_url type=scheme}https
{gwp_url type=domain}
{gwp_url type=domain index=-1}
{gwp_url type=domain index=0}
gravitywp.com
com
gravitywp
{gwp_url type=path}
{gwp_url type=path index=-1}
{gwp_url type=path index=-2}
/docs/gwp_url/
gwp_url
docs

Last updated: 13-04-2023

Advanced Merge Tagsv1.4

To use the functionalities described in this documentation, you'll need to get the GravityWP - Advanced Merge Tags add-on.

Read more