Title: Problem with JavaScript Age Gate
Last modified: February 1, 2019

---

# Problem with JavaScript Age Gate

 *  [Ate Up With Motor](https://wordpress.org/support/users/ate-up-with-motor/)
 * (@ate-up-with-motor)
 * [7 years, 4 months ago](https://wordpress.org/support/topic/problem-with-javascript-age-gate/)
 * I’ve been experimenting with the plugin, and it works in normal mode with caching
   off, but I can’t get the JavaScript mode (which I’ll need with WP Super Cache),
   in either Admin AJAX or REST API mode. The latter seems like it might cause an
   issue, since my security settings restrict anonymous REST API requests. Am I 
   doing something wrong?
 * Here’s the test page I created:
 * [Age Verification test](https://aaronseverson.com/uncategorized/age-verification-test/)
 * Thanks!
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fproblem-with-javascript-age-gate%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Author [Phil](https://wordpress.org/support/users/philsbury/)
 * (@philsbury)
 * [7 years, 4 months ago](https://wordpress.org/support/topic/problem-with-javascript-age-gate/#post-11156862)
 * Hi [@ate-up-with-motor](https://wordpress.org/support/users/ate-up-with-motor/),
 * I don’t think we should deny access to the API or admin-ajax. There are many 
   valid reasons to need access to it (any form of dynamic loading, for example).
   But I get why people want to.
 * What I do though is restrict _parts_ of the API. Or rather enable them, so in
   this case I would enable the `age-gate` endpoint (how you do this will depend
   on you security plugin, or server config if handled there)
 * I also restrict access to the API itself to be only the site running it or those
   that need access. There’s some goof information on how to to [that here](https://joshpress.net/access-control-headers-for-the-wordpress-rest-api/).
   I think admin-ajax is already restricted to the same site.
 * The link you’ve put as a test doesn’t seem to have the content restricted option
   checked (assuming you’re using selected content here?)
 * Cheers
    Phil
 *  Thread Starter [Ate Up With Motor](https://wordpress.org/support/users/ate-up-with-motor/)
 * (@ate-up-with-motor)
 * [7 years, 4 months ago](https://wordpress.org/support/topic/problem-with-javascript-age-gate/#post-11157315)
 * The linked post is set to restricted (the Age Gate checkbox is ticked, and in
   the posts list it shows the closed lock icon). If I switch back to standard rather
   than JavaScript mode, the Age Gate comes up, but it doesn’t work at all in JavaScript
   mode, in either setting. I currently have the Age Gate Advanced Settings set 
   to Admin Ajax; the hook query string option is disabled.
 * Regarding restrictions, I use iThemes Security, which has two settings for REST
   API: Default Access and Restricted Access; the latter doesn’t turn off the REST
   API completely (as some plugins do), which tends to break things, but restricts
   it for many things — [this post](https://ithemes.com/security/wordpress-rest-api-restrict-access/)
   explains their rationale. I use the latter setting, which hasn’t caused any issues
   with my other plugins, but doesn’t offer granular control of the endpoints.
 * (I’d previously used a separate plugin that allowed very fine-tuned control over
   the endpoint access, but I removed it because it was SO granular that it was 
   really troublesome to find which endpoints needed to be accessible to avoid errors,
   especially since some plugin developers aren’t great at labeling things.)
 * The iThemes plugin doesn’t restrict admin AJAX, and as far as I know, I haven’t
   done anything else that should interfere with that.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Problem with JavaScript Age Gate’ 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/)

 * 2 replies
 * 2 participants
 * Last reply from: [Ate Up With Motor](https://wordpress.org/support/users/ate-up-with-motor/)
 * Last activity: [7 years, 4 months ago](https://wordpress.org/support/topic/problem-with-javascript-age-gate/#post-11157315)
 * Status: not resolved