comment_save_pre

Filters the comment content before it is updated in the database.

Description

apply_filters( 'comment_save_pre', (string) $data_comment_content ); 

Parameters (1)

0. $data_comment_content (string)
The data comment content.

Usage

To run the hook, copy the example below.
  1. $data_comment_content = apply_filters( 'comment_save_pre', $data_comment_content ); 
  2.  
  3. if ( !empty( $data_comment_content ) ) { 
  4.  
  5. // everything has led up to this point... 
  6.  
  7.  
The following example is for adding a hook callback.
  1. // define the comment_save_pre callback 
  2. function filter_comment_save_pre( $data_comment_content ) { 
  3. // make filter magic happen here... 
  4. return $data_comment_content
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( 'comment_save_pre', 'filter_comment_save_pre', 10, 1 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( 'comment_save_pre', 'filter_comment_save_pre', 10, 1 ); 

Defined (1)

The filter is defined in the following location(s).

/wp-includes/comment.php  
  1. $data['comment_content'] = apply_filters( 'comment_save_pre', $data['comment_content'] );