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'm currently working with custom comment meta, and I have some custom additional field such as rating etc, when user write a comment ( not comment reply ) I want to show the rating field, but when it's on reply comment state I want to remove this field.

Is there a build in conditional function to check whether it's in a reply state or not? or any other way to achieve what I want?

share|improve this question

Check for the comment_parent:

if( '0' != $comment->comment_parent ){
    // this is a reply
share|improve this answer
thanks for the answer @diggy, I'm using comment_form() function to output the comment in the theme, so how can I do this using comment hook? – nonsensecreativity Jan 16 '13 at 0:21
comment_form displays the form, I assume you want to customize comments, and not the form? Check for wp_list_comments to find out what callback function is used to display comments, e.g. in twentytwelve the callback is twentytwelve_comment, which is located in functions.php. Edit the callback function to incorporate the rating data, e.g. <?php if ( '0' == $comment->comment_parent ) : ?>RATING STUFF GOES HERE<?php endif; ?> – diggy Jan 16 '13 at 0:30
I just made it work using global $comment in the comment_form_after_fields action, one thing not going well is when I open the link to reply manually it work eq.(localhost/wp/?p=123&replytocom=17#respond) , but not while using comment-reply.js when the comment is just move to another place but not removing the field. Any idea? – nonsensecreativity Jan 16 '13 at 0:36

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.