☰
Documentation

gwp_post_id

The {gwp_post_id} merge tag returns the post-id for a certain url.

Parameters

  • url – The URL of the post for which the ID is to be retrieved. This parameter is required.

Example Usage

{gwp_post_id url="/some-post/"}

This will output the ID of the post located at “https://yoursite.com/some-post/”. If the post ID cannot be found, the merge tag returns nothing, or an error message if you show errors in the plugin settings.

Use a URL from a field

The url parameter supports nested merge tags. Write the merge tag with *| and |* instead of curly brackets:

{gwp_post_id url="*|Page URL:4|*"}

The URL must be a URL of this WordPress site; the lookup uses the WordPress function url_to_postid().

Proudly powered by WordPress