Title: Custom user agent
Last modified: November 4, 2020

---

# Custom user agent

 *  Resolved [woomigrating](https://wordpress.org/support/users/woomigrating/)
 * (@woomigrating)
 * [5 years, 6 months ago](https://wordpress.org/support/topic/custom-user-agent/)
 * Hi,
 * I need to disable age gate when the user agent contains a certain word.
 * I’m thinking it could be done either by using some wildcard in the “Custom bots”
   field if that would work?
 * Or by a snippet preventing age gate from loading if some condition is met, if
   there is such a hook?
 * Would much appreciate any help!

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

 *  Plugin Author [Phil](https://wordpress.org/support/users/philsbury/)
 * (@philsbury)
 * [5 years, 6 months ago](https://wordpress.org/support/topic/custom-user-agent/#post-13620733)
 * Hi [@woomigrating](https://wordpress.org/support/users/woomigrating/),
 * It you know the full user agent, the the custom bots should work. That doesn’t’t
   support any wildcarding at this time.
 * There’s a few restriction based filters, probably the best one for you would 
   be `age_gate_restricted`. Here’s an example:
 *     ```
       add_filter('age_gate_restricted', function($restricted, $meta) {
         if (...) { // your test
           return false; //your test matches, so don't restrict
         }
         return $restricted; // return whatever we were passed if above doesn't evaluate
       }, 10, 2);
       ```
   
 * Thanks
    Phil
 *  Thread Starter [woomigrating](https://wordpress.org/support/users/woomigrating/)
 * (@woomigrating)
 * [5 years, 6 months ago](https://wordpress.org/support/topic/custom-user-agent/#post-13620891)
 * 12 minutes to answer, that’s impressive!
 * Also the filter seems to work perfect, thanks a lot!!!

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

The topic ‘Custom user agent’ 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: [woomigrating](https://wordpress.org/support/users/woomigrating/)
 * Last activity: [5 years, 6 months ago](https://wordpress.org/support/topic/custom-user-agent/#post-13620891)
 * Status: resolved