edit_comment
Action HookDescription
Fires immediately after a comment is updated in the database. The hook also fires immediately before comment status transition hooks are fired.Hook Information
File Location |
wp-includes/comment.php
View on GitHub
|
Hook Type | Action |
Line Number | 2686 |
Hook Parameters
Type | Name | Description |
---|---|---|
int
|
$comment_id
|
The comment ID. |
array
|
$data
|
Comment data. |
Usage Examples
Basic Usage
<?php
// Hook into edit_comment
add_action('edit_comment', 'my_custom_function', 10, 2);
function my_custom_function($comment_id, $data) {
// Your custom code here
}
Source Code Context
wp-includes/comment.php:2686
- How this hook is used in WordPress core
<?php
2681 * @since 4.6.0 Added the `$data` parameter.
2682 *
2683 * @param int $comment_id The comment ID.
2684 * @param array $data Comment data.
2685 */
2686 do_action( 'edit_comment', $comment_id, $data );
2687
2688 $comment = get_comment( $comment_id );
2689
2690 wp_transition_comment_status( $comment->comment_approved, $old_status, $comment );
2691
PHP Documentation
<?php
/**
* Fires immediately after a comment is updated in the database.
*
* The hook also fires immediately before comment status transition hooks are fired.
*
* @since 1.2.0
* @since 4.6.0 Added the `$data` parameter.
*
* @param int $comment_id The comment ID.
* @param array $data Comment data.
*/
Quick Info
- Hook Type: Action
- Parameters: 2
- File: wp-includes/comment.php
Related Hooks
Related hooks will be displayed here in future updates.