comment_on_trash
Action HookDescription
Fires when a comment is attempted on a trashed post.Hook Information
File Location |
wp-includes/comment.php
View on GitHub
|
Hook Type | Action |
Line Number | 3629 |
Hook Parameters
Type | Name | Description |
---|---|---|
int
|
$comment_post_id
|
Post ID. |
Usage Examples
Basic Usage
<?php
// Hook into comment_on_trash
add_action('comment_on_trash', 'my_custom_function', 10, 1);
function my_custom_function($comment_post_id) {
// Your custom code here
}
Source Code Context
wp-includes/comment.php:3629
- How this hook is used in WordPress core
<?php
3624 *
3625 * @since 2.9.0
3626 *
3627 * @param int $comment_post_id Post ID.
3628 */
3629 do_action( 'comment_on_trash', $comment_post_id );
3630
3631 return new WP_Error( 'comment_on_trash' );
3632
3633 } elseif ( ! $status_obj->public && ! $status_obj->private ) {
3634
PHP Documentation
<?php
/**
* Fires when a comment is attempted on a trashed post.
*
* @since 2.9.0
*
* @param int $comment_post_id Post ID.
*/
Quick Info
- Hook Type: Action
- Parameters: 1
- File: wp-includes/comment.php
Related Hooks
Related hooks will be displayed here in future updates.