comment_text хук-фильтрWP 1.2.0

Filters the text of a comment to be displayed.

Использование

add_filter( 'comment_text', 'wp_kama_comment_text_filter', 10, 3 );

/**
 * Function for `comment_text` filter-hook.
 * 
 * @param string          $comment_text Text of the current comment.
 * @param WP_Comment|null $comment      The comment object. Null if not found.
 * @param array           $args         An array of arguments.
 *
 * @return string
 */
function wp_kama_comment_text_filter( $comment_text, $comment, $args ){

	// filter...
	return $comment_text;
}
$comment_text(строка)
Text of the current comment.
$comment(WP_Comment|null)
The comment object. Null if not found.
$args(массив)
An array of arguments.

Список изменений

С версии 1.2.0 Введена.

Где вызывается хук

comment_text()
comment_text
WP_REST_Comments_Controller::prepare_item_for_response()
comment_text
check_comment()
comment_text
render_block_core_comment_content()
comment_text
wp-includes/comment-template.php 1030
echo apply_filters( 'comment_text', $comment_text, $comment, $args );
wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php 1090
'rendered' => apply_filters( 'comment_text', $comment->comment_content, $comment ),
wp-includes/comment.php 48
$comment = apply_filters( 'comment_text', $comment, null, array() );
wp-includes/blocks/comment-content.php 35
$comment_text = apply_filters( 'comment_text', $comment_text, $comment, $args );

Где используется хук в WordPress

wp-includes/class-walker-comment.php 190
add_filter( 'comment_text', array( $this, 'filter_comment_text' ), 40, 2 );
wp-includes/class-walker-comment.php 208
remove_filter( 'comment_text', array( $this, 'filter_comment_text' ), 40 );
wp-includes/default-filters.php 156
add_filter( 'comment_text', 'capital_P_dangit', 31 );
wp-includes/default-filters.php 206
add_filter( 'comment_text', 'wptexturize' );
wp-includes/default-filters.php 207
add_filter( 'comment_text', 'convert_chars' );
wp-includes/default-filters.php 208
add_filter( 'comment_text', 'make_clickable', 9 );
wp-includes/default-filters.php 209
add_filter( 'comment_text', 'force_balance_tags', 25 );
wp-includes/default-filters.php 210
add_filter( 'comment_text', 'convert_smilies', 20 );
wp-includes/default-filters.php 211
add_filter( 'comment_text', 'wpautop', 30 );
wp-includes/default-filters.php 47
add_filter( 'comment_text', 'wp_kses_post' );