WordPress at Your Fingertips
function is not described

Walker_Comment::filter_comment_text() public WP 5.4.2

Filters the comment text.

Removes links from the pending comment's text if the commenter did not consent to the comment cookies.

{} It's a method of the class: Walker_Comment{}

No Hooks.


String. Filtered text of the current comment.


$Walker_Comment = new Walker_Comment();
$Walker_Comment->filter_comment_text( $comment_text, $comment );
$comment_text(string) (required)
Text of the current comment.
$comment(WP_Comment|null) (required)
The comment object. Null if not found.


Since 5.4.2 Introduced.

Code of Walker_Comment::filter_comment_text() WP 5.8

public function filter_comment_text( $comment_text, $comment ) {
	$commenter          = wp_get_current_commenter();
	$show_pending_links = ! empty( $commenter['comment_author'] );

	if ( $comment && '0' == $comment->comment_approved && ! $show_pending_links ) {
		$comment_text = wp_kses( $comment_text, array() );

	return $comment_text;