Agy provides a couple of useful filters and actions to modify the plugin’s behavior. This docs section is dedicated to developers, so expect a lot of code to read.
agy_supported_post_types
By default, Agy supports age restrictions for posts, pages, and products. If you like to extend it to other custom post types you can do that with the filter like so:
add_filter( 'agy_supported_post_types', function ( $post_types ) {
$post_types[] = 'books';
return $post_types;
} );
agy_accept_template
You can completely overwrite all of the templates of Agy with this filter. Copy the template from plugins/content-warning-v2/src/templates add it to your child theme and use the filter to change the path to the template like so:
add_filter( 'agy_accept_template', function ( $path ) {
$path = get_stylesheet_directory() . '/templates/accept-age.php';
return $path;
} );
agy_use_sofort_ident
You may want to use this filter to exclude certain products from the Sofort Ident API verification. This filter is executed each time the verification is triggered. Include a custom logic or disable it for certain products to reduce the number of monthly validation requests.
add_filter('agy_use_sofort_ident', function() {
// Add your custom logic here.
return true;
})