comment_text
Filters the text of a comment to be displayed.
Description
Parameters (2)
- 0. $comment_comment_content (unknown)
- The comment comment content.
- 1. $comment (unknown)
- The comment.
Usage
- To run the hook, copy the example below.
- $comment_comment_content = apply_filters( 'comment_text', $comment_comment_content, $comment );
- if ( !empty( $comment_comment_content ) ) {
- // everything has led up to this point...
- }
- The following example is for adding a hook callback.
- // define the comment_text callback
- function filter_comment_text( $comment_comment_content, $comment ) {
- // make filter magic happen here...
- return $comment_comment_content;
- };
- // add the filter
- add_filter( 'comment_text', 'filter_comment_text', 10, 2 );
- To remove a hook callback, use the example below.
- // remove the filter
- remove_filter( 'comment_text', 'filter_comment_text', 10, 2 );
Defined (3)
The filter is defined in the following location(s).
- /wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php
- 'rendered' => apply_filters( 'comment_text', $comment->comment_content, $comment ),
- /wp-includes/comment.php
- $comment = apply_filters( 'comment_text', $comment );
- /wp-includes/comment-template.php
- echo apply_filters( 'comment_text', $comment_text, $comment, $args );