untrashed_comment
Action HookDescription
Fires immediately after a comment is restored from the Trash.Hook Information
File Location |
wp-includes/comment.php
View on GitHub
|
Hook Type | Action |
Line Number | 1662 |
Hook Parameters
Type | Name | Description |
---|---|---|
string
|
$comment_id
|
The comment ID as a numeric string. |
WP_Comment
|
$comment
|
The untrashed comment. |
Usage Examples
Basic Usage
<?php
// Hook into untrashed_comment
add_action('untrashed_comment', 'my_custom_function', 10, 2);
function my_custom_function($comment_id, $comment) {
// Your custom code here
}
Source Code Context
wp-includes/comment.php:1662
- How this hook is used in WordPress core
<?php
1657 * @since 4.9.0 Added the `$comment` parameter.
1658 *
1659 * @param string $comment_id The comment ID as a numeric string.
1660 * @param WP_Comment $comment The untrashed comment.
1661 */
1662 do_action( 'untrashed_comment', $comment->comment_ID, $comment );
1663
1664 return true;
1665 }
1666
1667 return false;
PHP Documentation
<?php
/**
* Fires immediately after a comment is restored from the Trash.
*
* @since 2.9.0
* @since 4.9.0 Added the `$comment` parameter.
*
* @param string $comment_id The comment ID as a numeric string.
* @param WP_Comment $comment The untrashed comment.
*/
Quick Info
- Hook Type: Action
- Parameters: 2
- File: wp-includes/comment.php
Related Hooks
Related hooks will be displayed here in future updates.