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=}
Examples | Output |
---|---|
{gwp_url} | https://gravitywp.com/doc/gwp_url/ |
| https://gravitywp.com |
| https://gravitywp.com |
| https |
| gravitywp.com com gravitywp |
| /docs/gwp_url/ gwp_url docs |
Subdomain url
How does it work on a subdomain? Check it out.
Examples | Output |
---|---|
{gwp_url type=domain} | test.com |
{gwp_url type=domain index=-2} | ddev |
{gwp_url type=domain index=-1} | site |
{gwp_url type=domain index=0} | test |
{gwp_url type=domain index=1} | ddev |
{gwp_url type=domain index=2} | site |
Last updated: 06-12-2024