Add comments meta fields to comments metabox on post edit screen

I have few custom fields in comment form. How can I add these fields to comments metabox? I divide my question on 3 parts:

1) How to remove url field and add custom comment fields to comment quick edit form?

comments metabox

2) How to add custom fields to comment add form?

comment add form

3) Hot to add custom meta information to comment metabox here?

comment list metabox

Solutions Collecting From Web of "Add comments meta fields to comments metabox on post edit screen"

Unfortunately the hooks:


are not available for the post-comments list table, constructed within the wp_ajax_get-comments call. That table consists only of two columns: author and comment. The data for author, avatar, email, url and IP is displayed in the first column.

We can on the other hand use a hack like:

add_filter( 'get_comment_author_IP', function( $comment_author_IP, $comment_ID, $comment )
    if( doing_action( 'wp_ajax_get-comments' ) )
        echo 'Some Custom Text <br/>';

    return $comment_author_IP;
}, 10, 3 );

to display some data, in the first column, for each row. We could e.g. use a get_user_meta() call here.

Regarding how we can add custom input fields to the quick-edit comment form, we can also use a hack like this one:

add_filter( 'the_editor', function( $html )
    if( did_action( 'load-post.php' ) && false !== strpos( $html, 'id="replycontent"' ) )
        $html .= sprintf( 
            '<br/> %s <input type="text" name="newcomment_myphone" value="%s">',
            esc_html__( 'Phone', 'wpse' )

    return $html;
} );

where we target the replycontent editor it on the post.php screen. This might need further restriction. The field displays below the comment content editor:

custom field

It should then be possible to hook into the edit_comment action to store it into the user meta.

This should also work for the Add comment form but you might need javascript to insert the current value to the custom field. I’m sure it’s also possible to inject the custom fields, to the comment form, with javascript instead of the approach listed above.

You could try to hide the URL field with CSS:

#author-url, label[for="author-url"] {

Hopefully you can adjust this further.