custom field set cookie
-
I would like to capture the custom field input to a cookie. I have created a field for custom zip using the custom field documentation example. Trying to set the cookie with the field but the output is ‘ag_field_zip’ and not the value of the input field.
add_filter('pre_age_gate_custom_fields', 'my_ag_custom_zip', 10, 1); function my_ag_custom_zip($fields){ $fields .= '<label for="ag_field_zip" class="ag_field_zip_label">Please add your zip code</label></br>'; $fields .= '<input type="text" id="ag_field_zip" name="ag_field_zip" class="ag_zipcode" placeholder="zip code" value="" maxlength="12" size="12"/></br>'; $fields .= age_gate_error('ag_field_zip'); $zip_field = $_POST['ag_field_zip']; if(!isset($_COOKIE[ag_zip])) { setcookie('ag_zip', $zip_field, time()+31556926); } return $fields; }
The page I need help with: [log in to see the link]
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘custom field set cookie’ is closed to new replies.