I am trying to add some custom comment meta fields and when using roots this wont work. The code:
<?php
function add_comment_fields( $fields ) {
?>
<p class="comment-form-age">
<label for="age"><?php _e( 'Age' ); ?></label>
<input id="age" name="age" type="text" size="30" />
</p>
<?php
}
add_filter( 'comment_form_logged_in_after', 'add_comment_fields' );
function add_comment_meta_values($comment_id) {
if(isset($_POST['age'])) {
$age = wp_filter_nohtml_kses($_POST['age']);
add_comment_meta($comment_id, 'age', $age, false);
}
}
add_action ('comment_post', 'add_comment_meta_values', 1);
?>
Functions in other themes, but not roots. Why is this? What do I need to do different?