Modify Text Before & After Comment Form

In this tutorial, i’ll provide the PHP code you can use with any theme to change the text displayed before and after your comments form.

By default, WordPress generates comment notes that include text before and comment form allowed tags after your form which you may want to remove or customize.

Here’s the default form :

comment form default

And here’s an example of what you can do simply by adding the code at the end of your child themes functions.php file and customizing the text in the code:

change comment form notes

Here’s the code which i have modified as per the screenshot above:

One benefit of using this code is that it removes the comment form allowed tags. You can also achieve this by installing this plugin.

Its very easy to style because the code includes the comments-notes class which you can paste at the end of your child themes style sheet and add your own declarations.

You can also change the comments-notes class in the PHP code above if you want to style the before and after notes differently.

.comment-notes {
color: blue;
}

The code in this tutorial enables you to easily modify the default text and add a comment form policy, HTML or pretty much anything else.

Other Options

Pretty basic stuff, what do you think?


Comments

11 responses to “Modify Text Before & After Comment Form”

  1. […] but they can get started on their research in the WordPress Template Tag Reference and by visiting Brad Dalton’s tutorials. Some of the wording may be changed via the plugins Custom Comment Form Title and Advanced […]

  2. Great, thank you very much, appreciate!

    1. Brad Dalton Avatar
      Brad Dalton

      No worries.

  3. Brad, thank you so much for posting this! I literally just had this question the other day and was going to make a post on a forum asking how to accomplish this! Instead, I find someone posted a link to a few of your tutorials, and bam – my question already answered here! 🙂

    Mind answering a new question though? Do you have any code that I could add to make commenters’ website links open in a new window? I know it just needs the target=”_blank” code, but I wouldn’t know how to make a custom php to do that…? (I’m using Dynamik Website Builder, and if you have a php option like the above code, I could just easily add it in the custom functions section like I did with this code you gave here!)

    1. Brad Dalton Avatar
      Brad Dalton

      No worries Anthony

      I’ll email you the link to the code.

      1. Hi Brad, I would be interested, too, in this code. Thanks.

        1. Brad Dalton Avatar
          Brad Dalton

          Just published a new post with the code Chris.

  4. Great tipps, thanks a lot, exactly what I need right now!

    1. Brad Dalton Avatar
      Brad Dalton

      No worries Chris

  5. Brad, excellent piece of code. I got this added and works perfectly.

    1. Brad Dalton Avatar
      Brad Dalton

      Thanks Derek.

      Also works with any theme as it uses the WordPress filter hooks rather than any theme specific hooks.

Leave a Reply

Join 5000+ Followers

Get The Latest Free & Premium Tutorials Delivered The Second They’re Published.