0

I see that there are lots of filters and things you can do to remove fields or modify them. I have found some useful ones on this site. I want to take it a step further because I want to do some things that there does not seem to be a filter for. Like removing the labels. At least I have not found one yet. I also need to remove the submit button and want to replace it with an actual button. For styling purposes. So I thought I could copy the comment_form function out of the wp-includes/comment-template.php file and put it in my functions.php file so that I could make any modifications I wanted. Problem with that is that WordPress throws you one of those previously declared functions errors. So I was looking for the filter or action to unregister that function so that I can use it in my functions.php file but I can't find it. Do you know how I can do this?

I tried

 remove_action('comment_form');

but this did not work

1 Answer 1

0

That function is called directly in a theme, probably in comments.php. Remove the function call there, and use your own function with a different name.

Be aware many plugins rely on the code in the native function. If you change too much, some plugin might break.

You can edit the label element with a filter on 'comment_form_default_fields'. Please do not remove them, they are important for screen reader users.

1
  • I tried to modify the fields by passing args but the labels still show up. maybe it would be better to keep trying to modify it by filters so as to not break any plugins down the road
    – Jamie
    Feb 10, 2013 at 3:30

Your Answer

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

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