Add & store extra fields – WordPress Comments

Turns out Advanced Custom Fields, a plugin I was already using, makes it super easy to insert additional fields into the comment form.

ACF is so good that it has created a tutorial to do just this and how to output the data within the comment thread: https://www.advancedcustomfields.com/resources/get-values-comment/

However, by doing this the plugin adds a bunch of superfluous CSS and JS files to the front end so to remove these, add this bit of code to your functions.php:

// disable acf css on front-end acf forms
add_action( 'wp_print_styles', 'my_deregister_styles', 100 );

function my_deregister_styles() {
  wp_deregister_style( 'acf' );
  wp_deregister_style( 'acf-field-group' );
  wp_deregister_style( 'acf-global' );
  wp_deregister_style( 'acf-input' );
  wp_deregister_style( 'acf-datepicker' );
}