comment_on_password_protected
Action HookDescription
Fires when a comment is attempted on a password-protected post.Hook Information
File Location |
wp-includes/comment.php
View on GitHub
|
Hook Type | Action |
Line Number | 3658 |
Hook Parameters
Type | Name | Description |
---|---|---|
int
|
$comment_post_id
|
Post ID. |
Usage Examples
Basic Usage
<?php
// Hook into comment_on_password_protected
add_action('comment_on_password_protected', 'my_custom_function', 10, 1);
function my_custom_function($comment_post_id) {
// Your custom code here
}
Source Code Context
wp-includes/comment.php:3658
- How this hook is used in WordPress core
<?php
3653 *
3654 * @since 2.9.0
3655 *
3656 * @param int $comment_post_id Post ID.
3657 */
3658 do_action( 'comment_on_password_protected', $comment_post_id );
3659
3660 return new WP_Error( 'comment_on_password_protected' );
3661
3662 } else {
3663 /**
PHP Documentation
<?php
/**
* Fires when a comment is attempted on a password-protected 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.