On my website, I would like users to comment using a list, which will then generate a comment for the user.

For example, the comments section will have a multi-select box asking " which part of the article did you like?". The select box will list the sub headings of the article.

After the user submits their selection I will have php function to generate the comment saying "User X liked the introduction and Conclusion".

I have searched Google, but results only show how to change the look of the comments cosmetically.

Can anyone provide tutorials/pages/filters/hooks that will help in this situation?

Apologies for the lack of detail in the title. I could not find the best way to describe.

1 Answer 1


Three aspects to this:

  1. Adding the checkboxes to the comment form
  2. Adding the values from the checkboxes to the comment meta data
  3. Displaying the values of the checkboxes

    1. Assuming you want to dynamically generate these based on the headings in the article, you'll need to parse the post content for headings and add the checkboxes to the comment form. This could be done via JS or PHP, depending on your preference. If you're going to go with PHP you may want to make use of Transients so that you're not parsing the content on every page load.

    2. You can use the comment_post action hook, which is fired right after the comment itself has been added to the database, to check $_POST for the checkbox fields added in 1 above and then add these as comment meta using add_comment_meta.

    3. Number of ways to do this depending on your preference. I would recommend first trying the get_comment_text filter to add the values from the meta data.

  • Hey, Many thanks for the advice, it helped. I created comment meta and I changed my comment walker class to include get_comment_meta. I have an issue with the check-boxes though ( Your first step). Even though multiple boxes are selected only one value is submitted, not an array. Is there an actual limitation with Update_comment_meta? if not Ill have to review my Html again. @karpstrucking
    – Adzay
    Commented Jan 20, 2015 at 9:46
  • Make sure the checkboxes all have the same name with square brackets at the end, then your $_POST should include then as an array. Commented Jan 20, 2015 at 11:43

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.