Andrew Nevins
(@anevins)
WCLDN 2018 Contributor | Volunteer support
Hello,
I am looking right at your comments box and there is no disclaimer. Can you please link me to where it is?
Thanks.
Hi,
Add this to your child theme’s functions.php
add_action ( '__comment','my_comment_disclaimer',50);
function my_comment_disclaimer() {
echo "Disclaimer line";
}
Change priority to 5 like this for displaying disclaimer above the comments.
add_action ( '__comment','my_comment_disclaimer',5);
function my_comment_disclaimer() {
echo "Disclaimer line";
}
Hi Menaka,
and thank you for your solution. I had to do same think as you post your solution above with the action __comment. Your solution is working when there is at least 1 comment posted, otherwise the disclaimer line will not be rendered.
With the filter ‘comment_form_field_comment’ looks OK:
//add your disclaimer after the comment textarea
add_filter( 'comment_form_field_comment', 'insert_after_comment_textarea' );
function insert_after_comment_textarea( $comment_field ) {
return $comment_field.'<p class="comment-disclaimer">By posting your answer, you agree to our <a href="http://example.com/privacy/">privacy policy</a> </p>';
}