comment_save_pre
Filter HookDescription
Filters the comment content before it is updated in the database.Hook Information
File Location |
wp-includes/comment.php
View on GitHub
|
Hook Type | Filter |
Line Number | 2597 |
Hook Parameters
Type | Name | Description |
---|---|---|
string
|
$comment_content
|
The comment data. |
Usage Examples
Basic Usage
<?php
// Hook into comment_save_pre
add_filter('comment_save_pre', '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:2597
- How this hook is used in WordPress core
<?php
2592 *
2593 * @since 1.5.0
2594 *
2595 * @param string $comment_content The comment data.
2596 */
2597 $data['comment_content'] = apply_filters( 'comment_save_pre', $data['comment_content'] );
2598
2599 $data['comment_date_gmt'] = get_gmt_from_date( $data['comment_date'] );
2600
2601 if ( ! isset( $data['comment_approved'] ) ) {
2602 $data['comment_approved'] = 1;
PHP Documentation
<?php
/**
* Filters the comment content before it is updated in the database.
*
* @since 1.5.0
*
* @param string $comment_content The comment data.
*/
Quick Info
- Hook Type: Filter
- Parameters: 1
- File: wp-includes/comment.php
Related Hooks
Related hooks will be displayed here in future updates.