WordPress filter hook · part of WordPress core
comment_edit_pre
A WordPress core filter that 5 plugins also fire themselves, running on 80K+ sites between them.
“This filter is documented in wp-admin/includes/comment.php”
How to use comment_edit_pre
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( 'comment_edit_pre', function( $comment_content ) {
// Change $comment_content here.
return $comment_content;
}, 10, 1 );Argument names come from Customer Reviews for WooCommerce'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 →
5 plugins that fire comment_edit_pre
Sorted by active installs. Each entry shows where the plugin calls the hook and what it passes.
-
Customer Reviews for WooCommerce80,000+ installs
apply_filters( 'comment_edit_pre', $comment->comment_content )includes/qna/class-cr-qna-list-table.php:710 -
Mihdan: Ajax Edit Comments300+ installs
apply_filters( 'comment_edit_pre', $comment->comment_content )lib/class.ajax.php:560 -
YOOAdmin10+ installs
apply_filters( 'comment_edit_pre', $comment->comment_content )includes/admin/comments-page.php:978 -
NMT Sitewide moderationFewer than 10 installs
apply_filters( 'comment_edit_pre', $comment->comment_content )nmt_comment_list_table.php:430 -
Threaded Comments ManagementFewer than 10 installs
apply_filters( 'comment_edit_pre', $comment->comment_content )class-wp-tc-comments-list-table.php:82
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.