wp_anonymize_comment
Filters whether to anonymize the comment.
Usage
add_filter( 'wp_anonymize_comment', 'wp_kama_anonymize_comment_filter', 10, 3 ); /** * Function for `wp_anonymize_comment` filter-hook. * * @param bool|string $anon_message Whether to apply the comment anonymization (bool) or a custom message (string). * @param WP_Comment $comment WP_Comment object. * @param array $anonymized_comment Anonymized comment data. * * @return bool|string */ function wp_kama_anonymize_comment_filter( $anon_message, $comment, $anonymized_comment ){ // filter... return $anon_message; }
- $anon_message(true|false|string)
- Whether to apply the comment anonymization (bool) or a custom message (string).
Default: true - $comment(WP_Comment)
- WP_Comment object.
- $anonymized_comment(array)
- Anonymized comment data.
Changelog
Since 4.9.6 | Introduced. |
Where the hook is called
wp_anonymize_comment
wp-includes/comment.php 3916
$anon_message = apply_filters( 'wp_anonymize_comment', true, $comment, $anonymized_comment );