comment_<old_status>_to_<new_status>
Fires when the comment status is in transition from one specific status to another.
Description
The dynamic portions of the hook name refer and $new_status
,, refer to the old and new comment statuses, respectively.
Parameters (1)
- 0. $comment (WP_Comment)
- Comment object.
Usage
- To run the hook, copy the example below.
- // run the action
- do_action( 'comment_{$old_status}_to_{$new_status}', $comment );
- The following example is for adding a hook callback.
- // define the comment_<old_status>_to_<new_status> callback
- function action_comment_old_status_to_new_status( $comment ) {
- // make action magic happen here...
- };
- // add the action
- add_action( "comment_{$old_status}_to_{$new_status}", 'action_comment_old_status_to_new_status', 10, 1 );
- To remove a hook callback, use the example below.
- // remove the action
- remove_action( "comment_{$old_status}_to_{$new_status}", 'action_comment_old_status_to_new_status', 10, 1 );
Defined (1)
The action is defined in the following location(s).
- /wp-includes/comment.php
- do_action( "comment_{$old_status}_to_{$new_status}", $comment );