untrash_post_comments
Action HookDescription
Fires before comments are restored for a post from the Trash.Hook Information
File Location |
wp-includes/post.php
View on GitHub
|
Hook Type | Action |
Line Number | 4203 |
Hook Parameters
Type | Name | Description |
---|---|---|
int
|
$post_id
|
Post ID. |
Usage Examples
Basic Usage
<?php
// Hook into untrash_post_comments
add_action('untrash_post_comments', 'my_custom_function', 10, 1);
function my_custom_function($post_id) {
// Your custom code here
}
Source Code Context
wp-includes/post.php:4203
- How this hook is used in WordPress core
<?php
4198 *
4199 * @since 2.9.0
4200 *
4201 * @param int $post_id Post ID.
4202 */
4203 do_action( 'untrash_post_comments', $post_id );
4204
4205 // Restore each comment to its original status.
4206 $group_by_status = array();
4207 foreach ( $statuses as $comment_id => $comment_status ) {
4208 $group_by_status[ $comment_status ][] = $comment_id;
PHP Documentation
<?php
/**
* Fires before comments are restored for a post from the Trash.
*
* @since 2.9.0
*
* @param int $post_id Post ID.
*/
Quick Info
- Hook Type: Action
- Parameters: 1
- File: wp-includes/post.php
Related Hooks
Related hooks will be displayed here in future updates.