Title: Making a widget conditional on cookie(s)
Last modified: August 11, 2018

---

# Making a widget conditional on cookie(s)

 *  [Ate Up With Motor](https://wordpress.org/support/users/ate-up-with-motor/)
 * (@ate-up-with-motor)
 * [7 years, 8 months ago](https://wordpress.org/support/topic/making-a-widget-conditional-on-cookies/)
 * Is there a way to use WordPress conditional tags to make a particular widget 
   only load if the visitor has stored a particular cookie? (I have Widget Logic,
   but this really concerns the proper choice/syntax of conditional tags rather 
   than the plugin itself, which just provides a convenient way to insert them.)
 * I have a PayPal button in a widget, and I would like to set that widget so that
   it only loads if the visitor has previously “I accept” on the privacy bar, which
   sets a cookie “gdpr%5Bprivacy_bar%5D” with content 1.
 * Does anyone have any suggestions of how I could set a conditional tag that looks
   for the presence of this cookie/value, so I can place that with Widget Logic?
 * (I understand the principle of conditional tags, but the syntax of them is pretty
   opaque — this is not my field!)
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fmaking-a-widget-conditional-on-cookies%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 1 replies (of 1 total)

 *  Moderator [Steven Stern (sterndata)](https://wordpress.org/support/users/sterndata/)
 * (@sterndata)
 * Volunteer Forum Moderator
 * [7 years, 8 months ago](https://wordpress.org/support/topic/making-a-widget-conditional-on-cookies/#post-10581670)
 * I’m pretty sure that you could use Widget Logic for that.
 * [https://wordpress.org/plugins/widget-logic/](https://wordpress.org/plugins/widget-logic/)
 * You’d not use conditional tags but your own function to test for the existence
   of a particular cookie.
 * There are some examples of how to get cookies here: [https://premium.wpmudev.org/blog/set-get-delete-cookies/](https://premium.wpmudev.org/blog/set-get-delete-cookies/)
    -  This reply was modified 7 years, 8 months ago by [Steven Stern (sterndata)](https://wordpress.org/support/users/sterndata/).

Viewing 1 replies (of 1 total)

The topic ‘Making a widget conditional on cookie(s)’ is closed to new replies.

## Tags

 * [conditional tags](https://wordpress.org/support/topic-tag/conditional-tags/)
 * [cookies](https://wordpress.org/support/topic-tag/cookies/)
 * [widgets](https://wordpress.org/support/topic-tag/widgets/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 2 participants
 * Last reply from: [Steven Stern (sterndata)](https://wordpress.org/support/users/sterndata/)
 * Last activity: [7 years, 8 months ago](https://wordpress.org/support/topic/making-a-widget-conditional-on-cookies/#post-10581670)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
