• Resolved easy123456

    (@easy123456)


    Hi Phil,
    great work with the age gate plugin.
    I am currently trying to exclude age gate on 2 pages. On all other pages age gate should be visible.
    How can I achive this via filter? In the options restricition is set to “All content”

    I tried this in my functions.php

    add_filter('age_gate_restricted', function ($restricted, $meta) {
    
    	if (is_page( 509 )) { 
    		return false;
    	} else {
    		return $restricted;
    	}
    }, 10, 2);

    but this is actually not working. any idea what i am doing wrong?
    Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Phil

    (@philsbury)

    Hi @easy123456,

    That filter should work… and cool you had a go at it, but there’s actually an option to exclude individual pages. On the Edit screen of your content there should be an Age Gate section on the right hand side that you can tick “Do not restrict” and then it shouldn’t show on those pages anymore.

    Thanks
    Phil

    Thread Starter easy123456

    (@easy123456)

    Hi @philsbury,

    Ok, then it’s strange why it did not work. I ended up using the option to exclude the individual pages at the end because I couldn’t get it to work using the code from above.

    Thanks

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Show Age Gate on every page except on 2’ is closed to new replies.