How to edit wordpress comment form fields

Below is the script of the video. If youíre having a hard time digesting
what Iím saying, the script below might help!


Hi, on this tutorial we will try to edit the comment form within wordpress. Letís try to open a post from the demo site. When we scroll down, there might be a couple of things that we may want to edit. Since Iím login as admin I might open this on another browser so we could see how it looks as a non-login visitor. I’m gonna copy and paste the url to that browser. We got a comment form right there. There are couple of things that we might want to edit right within that area. That is built in right within WordPress. There might be a couple of other plugins that can modify the areas in the comment form.

This specific tutorial will guide you on how to edit each part of the comment form. Although this is not really a straightforward tutorial, not as easy as ticking boxes but implementing a couple of codes. But these codes are not really hard to implement.

WordPress Codex and Comment Form Hook

The first thing that we need to do is go back on the dashboard. Then we might need to go on the appearance, then the editor and functions.php. Now let’s head over on the codex, the wordpress codex. The comment form is built through the couple of fields that have default values. Those are the values that we may want to edit. Just go ahead in this url and check to see what are the default values and fields.

edit wordpress comment formedit wordpress comment formAnd then we will use two different hooks. The first one iscomment form default†. This is used to to edit the words or overwrite a text right within the form itself. The other one is comment form default fields which is use to hide or remove a field.

I might be wrong but that is how I understand. Iím not an expert coder, but I know my method works. So If youíre an expert coder, feel free to comment down below. There might be a better way of doing things out. But on a general basis, this should work.

Comment Form Default

edit wordpress comment formSo now, letís try adding our codes. The first one is change the text on the comment form. We have in the field label submit, title reply and logged in as. Those are found in the wordpress codex that Iíve discussed earlier. The title reply default value is leave a reply.†If we want to edit that, we just gonna go to our chunks of code. We gonna set the title reply to ďgot something to share? Letís hear it.Ē Then just copy the chunks of code. (refer to video) Then head over on the dashboard, go on the appearance, then editor and find functions.php. Scroll down the very bottom of your functions.php. Yours might not look like the same as mine. At the very bottom just paste the codes. Make sure there is no enter key at the very end of the file. Sometimes it screw up the wordpress, sometimes it doesnít. Then hit update file. Then Iím gonna go to our demo site and expect that ďleave a replyĒ changed into ďgot something to share? Letís hear it.Ē

You can also change post comment to add comment. Just edit and copy the code and paste in to the functions.php area. Hit update file. Reload the site again and there you can see it changed to add comment. So thatís how you edit. You are not limited to those fields. We got a lot of fields to edit. If you want to edit those fields, you can do so by adding a new lines. You might want to copy those entire lines, enter and paste and easily change into something else like label submit, title reply after. You may play around. After checking it out you can get to see what those parts are doing in the comment form itself.

Comment Form Default Fields

Now, letís say we want to remove a field on the comment form. You can edit the codes at the comment form default fields which is use to hide or remove a field. Again you have to copy the short chunk of code, edit and go on to the functions.php. And then scroll down the very bottom of the file, hit a couple of enter keys and paste. Hit update and thatís it!. Same as the the first hook. Thatís how you remove a field.

Okay, if you got a better way to do that, you might want to add that in the comment form below. If you might want to implement another thing, just go ahead and visit the codex right within the†wordpress.org. If you have any questions please let me know. Thanks!

Leave a reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Book your free consultation
Share This