WordPress filter hook · part of WordPress core
get_comment_text
A WordPress core filter that 17 plugins also fire themselves, running on 16K+ sites between them.
“This filter documented in wp-includes/comment-template.php”
How to use get_comment_text
It's a filter: your callback receives the value, and must return the (changed) value.
Add this to your theme's functions.php or a small custom plugin:
add_filter( 'get_comment_text', function( $comment_content ) {
// Change $comment_content here.
return $comment_content;
}, 10, 1 );Argument names come from WP Tab Widget's source. Other plugins may pass different values: check the call in the plugin you're targeting below.
This hook is fired by WordPress core too. Official reference on developer.wordpress.org →
17 plugins that fire get_comment_text
Sorted by active installs. Each entry shows where the plugin calls the hook and what it passes.
-
WP Tab Widget10,000+ installs
apply_filters( 'get_comment_text', $comment->comment_content )wp-tab-widget.php:518 -
Urvanov Syntax Highlighter3,000+ installs
apply_filters( 'get_comment_text', $comment->comment_content, $comment )class-urvanov-syntax-highlighter-plugin.php:588 -
Simple Comment Editing2,000+ installs
apply_filters( 'get_comment_text', $comment_content_to_return, $comment, array() )includes/Functions.php:84 -
Mihdan: Ajax Edit Comments300+ installs
apply_filters( 'get_comment_text', AECUtility::encode($comment['comment_content']) )lib/class.ajax.php:395 -
WP-UserAgent200+ installs
apply_filters( 'get_comment_text', $comment->comment_content, $comment )wp-useragent.php:197 -
All-in-one Widget100+ installs
apply_filters( 'get_comment_text', $comment->comment_content )widgets/widget-tabs.php:508 -
WP Foundation Shortcodes100+ installs
apply_filters( 'get_comment_text', $comment->comment_content )class.foundation_shortcodes.php:1879 -
Comment Mail100+ installs
apply_filters( 'get_comment_text', $markup, $comment, [] )src/includes/classes/UtilsMarkup.php:772 -
Super Related Posts50+ installs
apply_filters( 'get_comment_text', $value )includes/output_tags.php:279 -
Ajax Comment Preview40+ installs
apply_filters( 'get_comment_text', $text )ajax-comment-preview.php:120 -
Expandable Dashboard Recent Comments30+ installs
apply_filters( 'get_comment_text', $comment->comment_content )expandable-dashboard-recent-comments.php:207 -
Ultra Community20+ installs
apply_filters( 'get_comment_text', $userReviewComment->comment_content, $userReviewComment )engine/Repository/UserRepository.php:385 -
Vacant Line BReaker10+ installs
apply_filters( 'get_comment_text', $comment->comment_content )vacant-line-breaker.php:217 -
WP-BigApp10+ installs
apply_filters( 'get_comment_text', $comment->comment_content, $comment )lib/json/class-wp-json-comments.php:208 -
AH Sidebar Box10+ installs
apply_filters( 'get_comment_text', $comment->comment_content )includes/recent-comments.php:22 -
WpApperFewer than 10 installs
apply_filters( 'get_comment_text', $comment->comment_content, $comment )lib/json/class-wp-json-comments.php:208 -
User Agent DisplayerFewer than 10 installs
apply_filters( 'get_comment_text', $comment->comment_content )agent.php:337
Need a customisation built on this hook?
Tell us what you want to change and which plugin it's for. We'll write it, test it and send it back as a small plugin.