wp_anonymize_comment
Filter HookDescription
Filters whether to anonymize the comment.Hook Information
File Location |
wp-includes/comment.php
View on GitHub
|
Hook Type | Filter |
Line Number | 3959 |
Hook Parameters
Type | Name | Description |
---|---|---|
bool|string
|
$anon_message
|
Whether to apply the comment anonymization (bool) or a custom message (string). Default true. |
WP_Comment
|
$comment
|
WP_Comment object. |
array
|
$anonymized_comment
|
Anonymized comment data. |
Usage Examples
Basic Usage
<?php
// Hook into wp_anonymize_comment
add_filter('wp_anonymize_comment', 'my_custom_filter', 10, 3);
function my_custom_filter($anon_message, $comment, $anonymized_comment) {
// Your custom filtering logic here
return $anon_message;
}
Source Code Context
wp-includes/comment.php:3959
- How this hook is used in WordPress core
<?php
3954 * @param bool|string $anon_message Whether to apply the comment anonymization (bool) or a custom
3955 * message (string). Default true.
3956 * @param WP_Comment $comment WP_Comment object.
3957 * @param array $anonymized_comment Anonymized comment data.
3958 */
3959 $anon_message = apply_filters( 'wp_anonymize_comment', true, $comment, $anonymized_comment );
3960
3961 if ( true !== $anon_message ) {
3962 if ( $anon_message && is_string( $anon_message ) ) {
3963 $messages[] = esc_html( $anon_message );
3964 } else {
PHP Documentation
<?php
/**
* Filters whether to anonymize the comment.
*
* @since 4.9.6
*
* @param bool|string $anon_message Whether to apply the comment anonymization (bool) or a custom
* message (string). Default true.
* @param WP_Comment $comment WP_Comment object.
* @param array $anonymized_comment Anonymized comment data.
*/
Quick Info
- Hook Type: Filter
- Parameters: 3
- File: wp-includes/comment.php
Related Hooks
Related hooks will be displayed here in future updates.