Skip to content

How to Show WordPress Popup Based on URL Parameter?

Key Takeaways

  • Popup Builder in Nexter Blocks Pro shows a popup only when the URL includes a matching parameter such as ?email=true, so the plain address does not render it.
  • The server-side check requires the literal value true, and ?email=1 or ?email=yes does not match.
  • Page caching can serve the wrong version of the page, so the parameter needs to be excluded from cache or tested with caching off first.
Table of Contents

One page, two audiences: the people who clicked your campaign link, and everyone else.

This condition shows the popup only when the address carries a parameter you name, so a campaign link can open it while the plain address does not.

For every Popup Builder setting in one place, see the Popup Builder block guide.

Before You Start

  • Edition: Pro — the Popup Builder block is part of Nexter Blocks Pro.
  • Block to enable: Popup Builder, switched on under Nexter > Blocks in your WordPress dashboard.
  • The popup’s content decided: a short message, a form, or a saved pattern to load into it.

Steps

  1. Add the Popup Builder block to your page and click Design from Scratch.
  1. In the Content panel, choose a Type and set the popup’s size.
The Content panel with the Type setting
  1. Set Content Type and add what the popup should show.
The Content Type setting with Pattern, Content, Editor and Shortcode
  1. Open Display Conditions and switch Based on URL Parameter on.
The Display Conditions panel with Based on URL Parameter and its URL field
  1. Enter a URL containing the parameter, written as ?email=true. The block reads the parameter name from what you type.
  1. Share the page address with that parameter on the end, for example https://example.com/plans/?email=true.
  1. Publish the page and test it on the front end.

A popup can have more than one display condition switched on at once. Leave On Button Click on only if you also want the button to open it.

How It Behaves

  • This condition is decided on the server. When the parameter is missing, the popup is not placed on the page at all — there is no hidden markup to find.
  • Loading the same page with the parameter present renders the popup normally. Both were verified.
  • Because the check happens before the page is sent, nothing about the popup is exposed to visitors who should not see it.
  • The value has to be exactly true. An address like ?email=1 or ?email=yes will not match.

Limitations

  • Pro only.
  • Only the literal value true matches, so the parameter cannot carry a name, an ID or any other value.
  • Because the decision happens on the server, page caching can serve a cached copy of the wrong version. Exclude the parameter from your cache, or test with caching off first.
  • Anyone can add the parameter to the address, so it controls presentation, not access.

Troubleshooting

The popup never appears

Check the address really ends with the parameter and the value is exactly true. Then check the field in the block contains the parameter too.

Nothing about the popup is in the page source

That is how this condition works — without a matching parameter the block renders nothing at all.

It shows for everyone

A cached copy of the page with the popup is being served to visitors without the parameter. Add the parameter to your cache plugin’s exclusions.

Related Docs

Share your Thoughts

Still in Doubt? Let’s Assist You

Have Feedback or Questions?

Join our WordPress Community on Facebook!