Title: Function and hook reference?
Last modified: September 4, 2023

---

# Function and hook reference?

 *  [Mikko](https://wordpress.org/support/users/sainionmikko/)
 * (@sainionmikko)
 * [2 years, 9 months ago](https://wordpress.org/support/topic/function-and-hook-reference/)
 * Hi,
 * I’ve scanned the documentation and this support forum, but don’t seem to be able
   to find a way to exclude content at html element level if the age gate was not
   passed. In the PHP rendering the page, I would like to echo some element only
   if the age gate was passed and show all other content in any case. I can read
   the cookie, and if that’s set, the gate would be passed. I would have to reload
   the page however after passing the gate for the cookie to be set and read before
   rendering the page. Is there a way to do that? Or perhaps I’m looking for a PHP
   function that would tell me if the gate was passed. Or is the plugin writing 
   any classes to some elements of tha passed page? That might work too. I found
   there might be a javascript event that fires when the gate is passed, but no 
   documentation on that. With that, I could write my own classes.

Viewing 1 replies (of 1 total)

 *  Thread Starter [Mikko](https://wordpress.org/support/users/sainionmikko/)
 * (@sainionmikko)
 * [2 years, 9 months ago](https://wordpress.org/support/topic/function-and-hook-reference/#post-17024377)
 * Actually, I worked out the following method:
    1. Refresh page when Age Gate is passed using the JavaScript event:
       window.addEventListener(‘
       age_gate_passed’, function() {    location.reload();})
    2. Checking if cookie is set in my PHP template; after the refresh it is correctly
       set:
       $age_passed = isset($_COOKIE[‘age_gate’]);
 * $age_passed is my boolean variable to use on elements to render only when the
   Age Gate was passed. Does this sound like it would work?

Viewing 1 replies (of 1 total)

The topic ‘Function and hook reference?’ is closed to new replies.

 * ![](https://ps.w.org/age-gate/assets/icon-256x256.png?rev=2783003)
 * [Age Gate](https://wordpress.org/plugins/age-gate/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/age-gate/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/age-gate/)
 * [Active Topics](https://wordpress.org/support/plugin/age-gate/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/age-gate/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/age-gate/reviews/)

 * 1 reply
 * 1 participant
 * Last reply from: [Mikko](https://wordpress.org/support/users/sainionmikko/)
 * Last activity: [2 years, 9 months ago](https://wordpress.org/support/topic/function-and-hook-reference/#post-17024377)
 * Status: not resolved