Skip to main content


Automatically Close popup

Automatically Close Popup After few Seconds from Popup Maker

In this article, I will show you how to automatically close popup after few seconds from Popup maker plugin.

In some cases, the user feels like nothing is happening then we need to close popup window automatically without any user activity. So here we can add a code snippet to close popup windows automatically from Popup maker.

Automatically Close Popup

The below code snippet is coded to close a popup from Popup Maker (ID: #pum-129 ) after few seconds.

Copy, paste and edit the below code any one in your parent or child theme functions.php file.

Replace the popup ID number in the given code example with the value is present in your popup. The ID is find in the WordPress admin at ‘Popup Maker’ >> ‘All Popups’ >> ‘CSS Classes’ (column). The integer value is added to the class name ‘popmake-‘.

add_action( 'wp_footer', 'my_custom_popup_scripts', 500 );
/**
 * Add a script to automatically close a popup after few seconds.
 *
 * @since 1.0.0
 *
 * @return void
 */
function my_custom_popup_scripts() { ?>
    <script type="text/javascript">
        (function ($, document, undefined) {

            $('#pum-129')
                .on('pumAfterOpen', function () {
                    var $popup = $(this);
                    setTimeout(function () {
                        $popup.popmake('close');
                    }, 10000); // 10 Seconds
                });

        }(jQuery, document))
    </script><?php
}

You can also read our few common WordPress issue related articles that will help to solve your issue.
1. How to Fix the 502 Bad Gateway Error in WordPress?
2. How to Fix the 504 Gateway Timeout Error in WordPress?
3. WordPress posts returning 404 Error
4. Fix “Missing a Temporary Folder” Error in WordPress website
5. How to Fix Syntax Error in WordPress?

I hope this article helped automatically close popup after few seconds from Popup Maker. I would like to make all our articles complete resource for users. You can also read our article on scroll to top of the page issue on Gravity form submission.

If you liked our articles, please subscribe to our YouTube Channel for WordPress Video Tutorials. You can also find us on social media platform like Twitter and Facebook.

Leave a Reply

Your email address will not be published. Required fields are marked *