When I update a comment in wordpress, the comment is wrapped with p tag.

Here's my code

remove_filter( 'the_content', 'wpautop' );
remove_filter( 'the_excerpt', 'wpautop' );
remove_filter( 'pre_comment_content', 'wp_filter_kses');
return wp_update_comment( $data );

I removed the wpautop filter but the problem didn't disappear. Does anyone know how to solve this problem?

1 Answer 1


Comments aren't part of the post body. Those won't be effected by the filters that you are trying to use. The core front end comment filters are these:

146 add_filter( 'comment_text', 'wptexturize'            );
147 add_filter( 'comment_text', 'convert_chars'          );
148 add_filter( 'comment_text', 'make_clickable',      9 );
149 add_filter( 'comment_text', 'force_balance_tags', 25 );
150 add_filter( 'comment_text', 'convert_smilies',    20 );
151 add_filter( 'comment_text', 'wpautop',            30 );

You will want to do something like:


With remove_filter() the priority hook isn't when remove_filter() runs, it is the priority of the callback that you are removing. It has to match.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.