Closing Pop-up when pressing ESCAPE hotkey



May you please share the required code to make this possible? I love how I can click outside, click the "X" or the link "never show again" but what about "pressing ESC" on my keyboard?

I hope your enjoying your evening.

p.s. - BTW, really awesome job with this plugin.

  • Vinod Dalvi
    • WP Unicorn

    Hi @Webmaster,

    I hope you are well today and thank you for your question.

    You can achieve this by using the attached small plugin specially developed for you that contains the following code.

    function custom_pp_scripts(){ ?>
    <script type="text/javascript">
    jQuery(document).ready( function($){
    	$(document).keyup(function(e) {
      		if (e.keyCode == 27) {
    			$('.wdpu-msg .wdpu-close').trigger('click');
    <?php }
    add_action('wp_footer', 'custom_pp_scripts');

    Best Regards,
    Vinod Dalvi

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.