Filter hook 'pre_comment_content'

in WP Core File wp-includes/comment.php at line 2175

View Source

pre_comment_content

Filter Hook
Description
Filters the comment content before it is set.

Hook Information

File Location wp-includes/comment.php View on GitHub
Hook Type Filter
Line Number 2175

Hook Parameters

Type Name Description
string $comment_content The comment content.

Usage Examples

Basic Usage
<?php
// Hook into pre_comment_content
add_filter('pre_comment_content', 'my_custom_filter', 10, 1);

function my_custom_filter($comment_content) {
    // Your custom filtering logic here
    return $comment_content;
}

Source Code Context

wp-includes/comment.php:2175 - How this hook is used in WordPress core
<?php
2170  	 *
2171  	 * @since 1.5.0
2172  	 *
2173  	 * @param string $comment_content The comment content.
2174  	 */
2175  	$commentdata['comment_content'] = apply_filters( 'pre_comment_content', $commentdata['comment_content'] );
2176  	/**
2177  	 * Filters the comment author's IP address before it is set.
2178  	 *
2179  	 * @since 1.5.0
2180  	 *

PHP Documentation

<?php
/**
	 * Filters the comment content before it is set.
	 *
	 * @since 1.5.0
	 *
	 * @param string $comment_content The comment content.
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 1
  • File: wp-includes/comment.php
Related Hooks

Related hooks will be displayed here in future updates.