age_gate_form_{$status}

You are reading the documentation for Age Gate 2.x. Switch to the documentation for 3.x.

This action is triggered whenever a user submits the Age Gate. The dynamic portion of the filter is the status of the submission, either success or failed.

Both actions receive an array, though it’s data differs depending on the input type:

Inputs/Selects

[
  'age_gate_age' => 18 // required age
  'age_gate_d' => 55 // user inputted day
  'age_gate_m' => 55 // user inputted month
  'age_gate_y' => 5555 // user inputted year
]

Buttons

[
  'age_gate_age' => 18, // required age
  'confirm_action' => 0 // bool of whether they clicked yes or no
]

Example

For this example we’ll create a very simple tracker to see how often the Age Gate is failed:

add_action('age_gate_form_failed', 'track_age_gate_fails');

function track_age_gate_fails($data = []){
  $count = get_option('age_gate_failures', 0);
  $count++;
  update_option('age_gate_failures', $count);
}