---
title: A Beginner’s Guide to Manually Creating Cookies
description: "Popup Maker gives you a few standard ways to create a [cookie](https://wppopupmaker.com/docs/getting-started/popup-maker-glossary-of-terms/#cookies) for your popup. For example, you can have your popup create a cookie for these built-in events: - After a popup closes - Right when a popup opens…"
url: "https://wppopupmaker.com/docs/controlling-popups/a-beginners-guide-to-manually-creating-cookies/"
updated: "2024-12-04"
category: Using Popup Maker / Controlling Popups
---

# A Beginner’s Guide to Manually Creating Cookies

Popup Maker gives you a few standard ways to create a [cookie](https://wppopupmaker.com/docs/getting-started/popup-maker-glossary-of-terms/#cookies) for your popup. For example, you can have your popup create a cookie for these built-in events:

- After a popup closes
- Right when a popup opens
- When someone submits a form that's in your popup

But what if you need to set a cookie in a way different from those standard options?

No problem. That's where our **Manual** cookie creation setting comes in. 

Using the **Manual** cookie creation setting lets you customize when your popup should create a cookie. For example, you might want a "Don't show this again" checkbox on your popup that allows people to dismiss the popup for the rest of their visit.

This guide walks through the steps for you to *manually* create a cookie for your popup. Here we go!

NOTE: The custom code in this example will automatically create any Manual cookie set up in your popup. So, if you have more than 1 Manual cookie, all cookies get created when the code runs.

See Pro Tip 2 for an example of how to selectively (or conditionally) choose a specific cookie to create.

## Setting the Stage

We're going to create a **Time Delay / Auto Open** popup that has a checkbox for your visitor to click if they don't want to see the popup again.

We'll need to do the following:

1. Add the checkbox to our popup.
2. Set up the popup trigger and cookie.
3. Write the custom code that "manually" creates our cookie.

### Add the Checkbox to Our Popup

**Step 1**: [Edit](https://wppopupmaker.com/docs/getting-started/add-a-popup-trigger/#edit-a-popup) your popup.

**Step 2**: Add your content using the popup editor.

**Step 3**: After you add your content, switch to the **Text** tab if you're not already there.

**Step 4**: Copy and paste the HTML code below.

```
<form id="dismiss-popup-form">
  <div>
    <input id="dismiss-checkbox" name="dismiss-checkbox" type="checkbox" value="dismiss-popup" />
    <label for="dismiss-checkbox">I don't want to see this again</label>
  </div>
</form>
```

Here's what that code will display on a web page.

![file Rdc5bhdou8](https://s3.amazonaws.com/helpscout.net/docs/assets/559c68b9e4b03e788eda1692/images/632acc19894a5358bdd78353/file-Rdc5bhdou8.png)

### Set Up the Popup Trigger and the Manual Cookie

**Step 1**: Scroll down to your **Popup Settings** and click **Add New Trigger** in the **Triggers** tab.

**Step 2**: Select [Time Delay / Auto Open](https://wppopupmaker.com/docs/getting-started/a-beginners-guide-to-popup-triggers/#time-delay) from the dropdown and click **Add**.

**Step 3**: Check the **Prevent popup from showing to visitor again using a cookie?** setting (checked is the default).

**Step 4**: Select **Manual** in the **Stop showing popup once visitor takes this action** dropdown.

![file lAKCubpFpT](https://s3.amazonaws.com/helpscout.net/docs/assets/559c68b9e4b03e788eda1692/images/622ad4c6c1688a6d26a7415b/file-lAKCubpFpT.png)

**Step 5**: Keep the default **Delay** time (500ms) and default **Cookie Name**, then click **Add**.

**Step 6**: Find the **Manual** cookie you just created and click the pencil icon next to it.

**Step 7**: Change the **Cookie Name** from the default `pum-nnn` to `pum-nnn-never-see-again` where `nnn` is your [popup's ID](https://wppopupmaker.com/docs/manage-features-or-options/find-the-popup-id/).

**Step 8**: We're going to change the **Cookie Time** from the default **1 month** to **1 year**. Then, click **Update**.

![popup maker cookie never see 600w](https://wppopupmaker.com/wp-content/uploads/popup-maker-cookie-never-see-600w.png)

Here's what your **Triggers** tab should look like so far.

![file ZLW4z0y7TU](https://s3.amazonaws.com/helpscout.net/docs/assets/559c68b9e4b03e788eda1692/images/626bd9f26c886c75aabeb74c/file-ZLW4z0y7TU.png)

**Step 9**: We won't set up any targeting rules so this test popup can appear on every post and page. We'll also keep the default display settings just to save time.

**Step 10**: Click **Publish** or **Update** on your popup to save your changes.

### Write the Custom Code

We're in the home stretch 😉

**Step 1**: Copy this code snippet and paste it into your child theme's functions.php file or use a code snippets plugin that supports PHP. Learn more in our [Getting Started With Custom PHP](https://wppopupmaker.com/docs/getting-started-with-custom-code/getting-started-with-custom-php/) guide.

```
function set_never_see_again_cookie() { ?>
 	<script type="text/javascript">
		jQuery(document).ready(function ($) {

			// Change the number 1234 to your popup ID number.
			$("#popmake-1234 #dismiss-checkbox").click(function(event) {
				if ($('#dismiss-checkbox').prop('checked')) {
            		                $('#popmake-1234').trigger('pumSetCookie'); // Change 1234 to your popup ID.
				} // if
			}); // click listener

		}); // jQuery
 	</script>
<?php }
add_action( 'wp_footer', 'set_never_see_again_cookie', 500 );
```

**Step 2**: Edit the snippet you just pasted. Every time you see *1234* change it to your [popup's ID number](https://wppopupmaker.com/docs/manage-features-or-options/find-the-popup-id/). Save your functions.php file or publish your code snippet if you're using a plugin.

**Step 3**: Flush [all of your caches](https://wordpress.org/support/article/i-make-changes-and-nothing-happens/). Bring up any post or page on your site. When your popup appears, click on the **I don't want to see this again** checkbox. Then, reload that same post or page or go anywhere else on your site. Your popup should not display again 😉

**Pro tip 1**: Want to close the popup when someone checks the dismiss checkbox? Add the Popup Maker [CSS](https://wppopupmaker.com/docs/getting-started/popup-maker-glossary-of-terms/#css) classes `popmake-close` and `pum-close` to the checkbox input HTML code. For example:

```
<input id="dismiss-checkbox" class="popmake-close pum-close" name="dismiss-checkbox" type="checkbox" value="dismiss-popup" />
```

**Pro tip 2**: What if you want 2 checkboxes and set a different cookie depending on which checkbox you click? For example, checkbox 1 dismisses the popup "forever" (1 year), and checkbox 2 dismisses the popup for 1 day.

In that case, you'll need to add another manual cookie and add another event listener to the code example above. Basically, you need a dedicated event listener for each checkbox. 

See the full [code example on GitHub](https://gist.github.com/marklchaves/969a1732c8191a99e68dbf63842db18a).

## Troubleshooting

What if it doesn't work? 

First, make sure you saved all of your code and your [purged all of your caches](https://wordpress.org/support/article/i-make-changes-and-nothing-happens/). You should also check your [browser console](https://wordpress.org/support/article/using-your-browser-to-diagnose-javascript-errors/#chrome) for any JavaScript errors. Lastly, double-check you added the correct [popup ID](https://wppopupmaker.com/docs/manage-features-or-options/find-the-popup-id/) to your custom code snippet.

Please see our [basic troubleshooting tips](https://wppopupmaker.com/docs/getting-started-with-custom-code/getting-started-with-custom-php/#basic-troubleshooting) for PHP related problems.
