# Elementor Dynamic Tag: URL Parameter

> Adds a dynamic tag that prints a value from the page address, such as ?city=Paris, so landing pages can echo campaign keywords in headings.

- Type: PHP
- Runs: Run everywhere
- Category: [Page Builders & Themes](https://wpide.com/library/category/page-builders/)
- Tags: elementor, dynamic-tags, landing-pages
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/elementor-dynamic-tag-url-parameter/

## Code

```php
add_action( 'elementor/dynamic_tags/register', function ( $dynamic_tags ) {
    if ( ! class_exists( '\Elementor\Core\DynamicTags\Tag' ) || ! class_exists( '\Elementor\Modules\DynamicTags\Module' ) ) {
        return;
    }

    if ( ! class_exists( 'WPIDE_Elementor_Url_Param_Tag' ) ) {
        class WPIDE_Elementor_Url_Param_Tag extends \Elementor\Core\DynamicTags\Tag {
            public function get_name() {
                return 'wpide-url-param';
            }

            public function get_title() {
                return 'URL Parameter';
            }

            public function get_group() {
                return 'wpide-visitor';
            }

            public function get_categories() {
                return array( \Elementor\Modules\DynamicTags\Module::TEXT_CATEGORY );
            }

            protected function register_controls() {
                $this->add_control( 'param', array( 'label' => 'Parameter name', 'type' => \Elementor\Controls_Manager::TEXT, 'default' => 'city' ) );
                $this->add_control( 'default_value', array( 'label' => 'When missing', 'type' => \Elementor\Controls_Manager::TEXT, 'default' => '' ) );
            }

            public function render() {
                $param = sanitize_key( (string) $this->get_settings( 'param' ) );
                $value = ( $param && isset( $_GET[ $param ] ) ) ? sanitize_text_field( wp_unslash( $_GET[ $param ] ) ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Recommended

                if ( '' === $value ) {
                    $value = (string) $this->get_settings( 'default_value' );
                }

                echo esc_html( mb_substr( $value, 0, 60 ) );
            }
        }
    }

    $dynamic_tags->register_group( 'wpide-visitor', array( 'title' => 'Visitor' ) );
    $dynamic_tags->register( new WPIDE_Elementor_Url_Param_Tag() );
} );
```

## Notes

Needs Elementor Pro. The value is limited to 60 plain-text characters and escaped before it is shown.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Elementor Dynamic Tag: URL Parameter" in its snippet library and add it in one click; or create a new PHP snippet in WPIDE (or any code snippets plugin) and paste the code above. More snippets: https://wpide.com/library/
