transition_comment_status

Fires when the comment status is in transition.

Description

do_action( 'transition_comment_status', (int|string) $new_status, (int|string) $old_status, (object) $comment ); 

Parameters (3)

0. $new_status (int|string)
The new comment status.
1. $old_status (int|string)
The old comment status.
2. $comment (object)
The comment data.

Usage

To run the hook, copy the example below.
  1. // run the action 
  2. do_action( 'transition_comment_status', $new_status, $old_status, $comment ); 
The following example is for adding a hook callback.
  1. // define the transition_comment_status callback 
  2. function action_transition_comment_status( $new_status, $old_status, $comment ) { 
  3. // make action magic happen here... 
  4. }; 
  5.  
  6. // add the action 
  7. add_action( 'transition_comment_status', 'action_transition_comment_status', 10, 3 ); 
To remove a hook callback, use the example below.
  1. // remove the action 
  2. remove_action( 'transition_comment_status', 'action_transition_comment_status', 10, 3 ); 

Defined (2)

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

/wp-includes/comment.php  
  1. do_action( 'transition_comment_status', $new_status, $old_status, $comment ); 
/wp-includes/default-filters.php  
  1. add_action( 'transition_comment_status', '_clear_modified_cache_on_transition_comment_status', 10, 2 );