I wish to add extra field in post comment section while admin is logged in.


I just add subject field in template comment form.But i couldn't store in db and retrieve it.

How can i do this ? Help me !

1 Answer 1


You can add it directly through your functions.php, unfortunately this is not documented very well at all.

You want to hook into add_comment_meta using add_action, to look at this further refer to line 500-ish of comment.php.

It looks like this

function add_comment_meta($comment_id, $meta_key, $meta_value, $unique = false) {

    return add_metadata('comment', $comment_id, $meta_key, $meta_value, $unique);

  • :could you please explain further. I couldn't see 500-ish line in comment.php. please
    – Gowri
    Commented Jul 8, 2011 at 12:31
  • Just do a text search for add_comment_meta in comments.php, it is somewhat documented there, phpcrossref.com/wordpress/wp-includes/…
    – Wyck
    Commented Jul 8, 2011 at 16:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.