Move the Comment Box Below the Name and Email Fields
Reorders the comment form so visitors fill in their name and email before writing the comment, the order many themes used before WordPress 4.4.
Opens WPIDE on
Code
add_filter( 'comment_form_fields', function ( $fields ) {
if ( ! isset( $fields['comment'] ) ) {
return $fields;
}
$comment = $fields['comment'];
unset( $fields['comment'] );
$cookies = isset( $fields['cookies'] ) ? $fields['cookies'] : null;
unset( $fields['cookies'] );
$fields['comment'] = $comment;
if ( null !== $cookies ) {
$fields['cookies'] = $cookies;
}
return $fields;
} );
How to add this snippet
- Install WPIDE on your WordPress site (it is free) and open Code Snippets.
- Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
- It is added inactive: review the code and settings, then switch it on.