Action hook 'comment_reply_to_unapproved_comment'

in WP Core File wp-includes/comment.php at line 3575

View Source

comment_reply_to_unapproved_comment

Action Hook
Description
Fires when a comment reply is attempted to an unapproved comment.

Hook Information

File Location wp-includes/comment.php View on GitHub
Hook Type Action
Line Number 3575

Hook Parameters

Type Name Description
int $comment_post_id Post ID.
int $comment_parent Parent comment ID.

Usage Examples

Basic Usage
<?php
// Hook into comment_reply_to_unapproved_comment
add_action('comment_reply_to_unapproved_comment', 'my_custom_function', 10, 2);

function my_custom_function($comment_post_id, $comment_parent) {
    // Your custom code here
}

Source Code Context

wp-includes/comment.php:3575 - How this hook is used in WordPress core
<?php
3570  			 * @since 6.2.0
3571  			 *
3572  			 * @param int $comment_post_id Post ID.
3573  			 * @param int $comment_parent  Parent comment ID.
3574  			 */
3575  			do_action( 'comment_reply_to_unapproved_comment', $comment_post_id, $comment_parent );
3576  
3577  			return new WP_Error( 'comment_reply_to_unapproved_comment', __( 'Sorry, replies to unapproved comments are not allowed.' ), 403 );
3578  		}
3579  	}
3580  

PHP Documentation

<?php
/**
			 * Fires when a comment reply is attempted to an unapproved comment.
			 *
			 * @since 6.2.0
			 *
			 * @param int $comment_post_id Post ID.
			 * @param int $comment_parent  Parent comment ID.
			 */
Quick Info
  • Hook Type: Action
  • Parameters: 2
  • File: wp-includes/comment.php
Related Hooks

Related hooks will be displayed here in future updates.