Integrations

How to add a popup to WordPress

WordPress has more popup plugins than any other platform, and most of them ship their own editor, their own database tables and their own update cycle. PopupForge takes a different route: the popup lives in PopupForge, and your WordPress site only loads one script tag. Changing the copy, the trigger or the targeting never touches WordPress again.

This guide covers the three ways to get that tag into your theme: a small header and footer snippet plugin (the safest option for non-developers), a wp_footer hook in a child theme (for developers who want zero extra plugins), and the scripts panel some themes add to the Customizer. Pick one; you do not need all three.

The script tag

<script src="https://getpopupforge.com/lead-modal.js?appId=YOUR_APP_ID&configId=YOUR_CONFIG_ID" async defer></script>

Replace YOUR_APP_ID and YOUR_CONFIG_ID with the values from the install panel of your published popup. The tag is the same on every platform; only where you paste it changes.

Step by step

  1. 01

    Build and publish the popup in PopupForge

    Create a free account, generate or design the popup in the visual editor, set the trigger and frequency, then publish it. The install panel shows your script tag with the appId and configId already filled in. Copy that exact tag; the placeholder version on this page will not load a popup.

  2. 02

    Option A: paste the tag with WPCode (Insert Headers and Footers)

    In wp-admin go to Plugins > Add New, install and activate WPCode (formerly Insert Headers and Footers). Open Code Snippets > Header & Footer, paste the PopupForge tag into the Footer box, and click Save Changes. The plugin prints the tag on every front-end page through the wp_footer hook.

  3. 03

    Option B: add a wp_footer hook in your child theme

    If you would rather not add a plugin, open the functions.php of your child theme (never the parent theme, updates overwrite it) and add: add_action('wp_footer', function () { echo '<script src="https://getpopupforge.com/lead-modal.js?appId=YOUR_APP_ID&configId=YOUR_CONFIG_ID" async defer></script>'; }); Replace the placeholders with your real IDs and save.

  4. 04

    Option C: use your theme's scripts panel

    Some themes and theme add-ons add a "Header/Footer scripts" or "Custom JS" panel under Appearance > Customize. Paste the tag into the footer field there. The Customizer's built-in Additional CSS panel accepts CSS only, so it cannot hold a script tag, and block themes hide the Customizer entirely unless a plugin needs it.

  5. 05

    Clear every cache layer

    WordPress sites usually cache at several levels: a caching plugin (WP Rocket, LiteSpeed Cache, W3 Total Cache), the host's server cache, and a CDN such as Cloudflare. Purge all of them after saving, otherwise visitors keep receiving the old HTML without the tag and the popup appears to be broken.

  6. 06

    Exclude the script from JavaScript optimizers

    If a performance plugin delays or combines JavaScript ("Delay JavaScript execution", "Minify/combine JS"), add lead-modal.js to its exclusion list. Delayed scripts only run after the visitor interacts, which breaks immediate and timed triggers and can hide the popup entirely on short visits.

  7. 07

    Test the popup and check the lead arrives

    Open the live site in a private browsing window so a previous session does not suppress the popup, trigger it the way you configured (wait for the delay, scroll, or move the pointer out through the top of the window), submit a test lead, then confirm it shows in the PopupForge lead list.

WordPress notes and gotchas

  • Free WordPress.com sites cannot install plugins or add custom JavaScript. At the time of writing any paid WordPress.com plan (Personal and up) can install WPCode. Self-hosted WordPress has no such restriction; check the WordPress.com plan comparison if you are unsure which one you are on.
  • Security plugins and hosts that add a Content-Security-Policy header can block the script or the iframe it injects. If the popup never appears and the browser console mentions CSP, allow https://getpopupforge.com in script-src, connect-src and frame-src.
  • Put the tag in the footer, not the header. It is async and defer anyway, but footer placement keeps it out of the critical path and avoids arguments with header-scanning optimizers.
  • A preview of a draft page in wp-admin may not render footer hooks the same way as the public site. Always test on the published front end.

Verify the install

Confirm the popup shows and the lead arrives

  1. 1.Open your site in a private window (Cmd+Shift+N or Ctrl+Shift+N). Right click > View Page Source and search for lead-modal.js; if it is missing, a cache has not been purged.
  2. 2.Trigger the popup as configured. For exit intent on desktop, move the pointer up and out through the top of the window.
  3. 3.Submit a test lead, then open PopupForge and check the lead list and the popup analytics (views and submissions).

Official WordPress documentation

Platform menus and plan rules change. If a step here no longer matches what you see, the official page above is the source of truth.

FAQ

Frequently asked questions

Do I need a WordPress popup plugin to use PopupForge?

No. The popup renders from PopupForge's script and the only thing WordPress does is print one script tag. WPCode is optional; it is just the easiest way for non-developers to add the tag without editing theme files.

Will the popup survive a theme update?

If you added the tag through WPCode or a child theme, yes. If you edited the parent theme's files directly, the next theme update deletes your change. That is why the guide never recommends editing the parent theme.

Can I show the popup only on certain WordPress pages?

Yes. Leave the tag site-wide and use URL targeting in PopupForge (include or exclude exact paths, wildcards and query strings; this is part of Pro targeting). Rules change from the PopupForge dashboard without touching WordPress.

Does the popup work with WooCommerce?

Yes on the storefront, product, category and cart pages, because they all use your theme's wp_footer. Use URL targeting to exclude the checkout and account pages if you do not want a popup interrupting a purchase.

Get your script tag

Generate a popup for your site, then paste one tag into WordPress.

The free generator shows three brand-matched directions from your URL, no account needed. Creating an account gives you the visual editor, triggers, URL targeting and the install panel with your real appId and configId.

Read next

Other platforms