Close Popup and Create Cookie When a Form is Submitted

Note: Popup Maker version 1.9 introduces the Form Submission trigger and cookie. Recommended good practice is to use the new trigger and cookie together when using a Popup Maker form or integration-supported WordPress form plugin inside a popup.

See:  Popup Maker Integration with WordPress Form Builder Plugins

Trigger: Form Submission

Warning! Code Ahead

Avoid the time and hassle of using code and switch to Ninja Forms, Gravity Forms, or Contact Form 7! Popup Maker comes with this functionality built-in if you're using the latest versions of Ninja Forms, Gravity Forms, or Contact Form 7.

Open and close popups, plus create Cookies on form submit with the click of a button by using Popup Maker and Ninja Forms, Gravity Forms, or Contact Form 7 together! Plus, these features work with all triggers.

See How Easy It Is

Traditional Solution with Code

This solution works for Auto Open/Time Delay, Scroll, and Exit Intent Triggers.

Setup Your Cookie

First, set up your Cookie you're using the Manual JavaScript Cookie Creation Event in the Popup Editor.

After clicking Add, you will be able to customize every aspect of how your Cookie will behave. For detailed explanations on all of the Cookie Settings and features, check out the  Cookie Settings and Features Doc.

Add and Edit Manual JavaScript

Add the following code to your site theme (or child-theme) 'functions.php' file starting with add_action()

 *  Add the following code to your theme (or child-theme)
 *  'functions.php' file starting with 'add_action()'.
 * -------------------------------------------------------------------------- */
add_action( 'wp_footer', 'my_custom_popup_scripts', 500 );
 *  Add custom JS script to footer to set a cookie that targets a popup by it's ID.
 *  Note: Popups are assigned a unique ID of '#popmake-{integer}'.
 *  From the WP Admin, view 'Popup Maker' -> 'All Popups' -> 'CSS Classes (column)'
 *  to locate the popup ID formatted as 'popmake-{integer}'. Change the placeholder
 *  ID ( '#popmake-967' ) in this code sample with your site's unique popup ID.
 *  @since 1.0.0
 *  @return void
function my_custom_popup_scripts() { ?>
	<script type="text/javascript">
        (function ($, document, undefined) {


            setTimeout(function () {
            }, 5000); // 5 seconds

        }(jQuery, document))

View the source on GitHub.

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.