How to Edit or Remove Before and After Comment Notes

In most standard WordPress themes, you’ll see before and after comment notes. This is an example from Twenty Twelve theme:

comment before

I’ve seen many people asking how to remove any of these notes. It turned out that this is very simple to do. Using comment_form_defaults filter, we can easily customize the notes or completely remove them.

Here’s a working snippet that can be placed on functions.php file of your theme.

1 2 3 4 5 6 7 8 9 10
/<?php
//* Remove comment before and after notes
add_filter( 'comment_form_defaults', 'afn_custom_comment_form' );
function afn_custom_comment_form($fields) {
$fields['comment_notes_before'] = ''; // Removes comment before notes
$fields['comment_notes_after'] = ''; // Removes comment after notes
return $fields;
}
view raw functions.php hosted with ❤ by GitHub

The comment_form_defaults filter accepts many parameters and to customize the before notes, we need to pass comment_notes_before parameter and to customize the after notes, we need to pass comment_notes_after parameter. The code above will completely remove the before and after comment notes. Here’s the result:

after comment notes

If you wish to change the before and after notes, simply put your text inside the ' ' tag and it will overwrite the default notes. Example:

$fields['comment_notes_before'] = 'This is an exampe of before comment notes.'; // Overwrite the default before comment notes.

We hope this tutorial helped you to edit or remove before and after comment notes on your WordPress site. If you’ve any question feel free to drop your comment below.

Leave a Reply

Your email address will not be published. Required fields are marked *