WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 !

share|improve this question

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);

share|improve this answer
:could you please explain further. I couldn't see 500-ish line in comment.php. please – Gowri Jul 8 '11 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 Jul 8 '11 at 16:38

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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