Action hook 'transition_comment_status'

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

View Source

transition_comment_status

Action Hook
Description
Fires when the comment status is in transition.

Hook Information

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

Hook Parameters

Type Name Description
string $new_status The new comment status.
string $old_status The old comment status.
WP_Comment $comment Comment object.

Usage Examples

Basic Usage
<?php
// Hook into transition_comment_status
add_action('transition_comment_status', 'my_custom_function', 10, 3);

function my_custom_function($new_status, $old_status, $comment) {
    // Your custom code here
}

Source Code Context

wp-includes/comment.php:1848 - How this hook is used in WordPress core
<?php
1843  		 *
1844  		 * @param string     $new_status The new comment status.
1845  		 * @param string     $old_status The old comment status.
1846  		 * @param WP_Comment $comment    Comment object.
1847  		 */
1848  		do_action( 'transition_comment_status', $new_status, $old_status, $comment );
1849  
1850  		/**
1851  		 * Fires when the comment status is in transition from one specific status to another.
1852  		 *
1853  		 * The dynamic portions of the hook name, `$old_status`, and `$new_status`,

PHP Documentation

<?php
/**
		 * Fires when the comment status is in transition.
		 *
		 * @since 2.7.0
		 *
		 * @param string     $new_status The new comment status.
		 * @param string     $old_status The old comment status.
		 * @param WP_Comment $comment    Comment object.
		 */
Quick Info
  • Hook Type: Action
  • Parameters: 3
  • File: wp-includes/comment.php
Related Hooks

Related hooks will be displayed here in future updates.