Advertise on Site! You can Advertise on our site. Find out More

how to add thank you message after comments wordpress

Many times we got requirement to add thank you message after adding comments added by users.

In this article I will show how to add custom message after getting comments from users. For this we going use the wordpress api. WordPress filters are very useful. You can find all wordpress hooks and filters in wp-includes/default-filters.php file.

function add_custom_text($content) {
return "
<div class=\"custom-text\">
Hello User!
Thank you for your comment.
WPAPI
</div>
";
}
add_filter('comment_text', 'add_custom_text', 1000);

Open your functions.php file from your active wordpress theme folder. copy paste the following code in that file. This is very simple trick but still it is really useful.

22 Comments

Add a Comment

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