unspam_comment
Action HookDescription
Fires immediately before a comment is unmarked as Spam.Hook Information
File Location |
wp-includes/comment.php
View on GitHub
|
Hook Type | Action |
Line Number | 1741 |
Hook Parameters
Type | Name | Description |
---|---|---|
string
|
$comment_id
|
The comment ID as a numeric string. |
WP_Comment
|
$comment
|
The comment to be unmarked as spam. |
Usage Examples
Basic Usage
<?php
// Hook into unspam_comment
add_action('unspam_comment', 'my_custom_function', 10, 2);
function my_custom_function($comment_id, $comment) {
// Your custom code here
}
Source Code Context
wp-includes/comment.php:1741
- How this hook is used in WordPress core
<?php
1736 * @since 4.9.0 Added the `$comment` parameter.
1737 *
1738 * @param string $comment_id The comment ID as a numeric string.
1739 * @param WP_Comment $comment The comment to be unmarked as spam.
1740 */
1741 do_action( 'unspam_comment', $comment->comment_ID, $comment );
1742
1743 $status = (string) get_comment_meta( $comment->comment_ID, '_wp_trash_meta_status', true );
1744 if ( empty( $status ) ) {
1745 $status = '0';
1746 }
PHP Documentation
<?php
/**
* Fires immediately before a comment is unmarked as Spam.
*
* @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 comment to be unmarked as spam.
*/
Quick Info
- Hook Type: Action
- Parameters: 2
- File: wp-includes/comment.php
Related Hooks
Related hooks will be displayed here in future updates.