Filter hook 'the_password_form_incorrect_password'

in WP Core File wp-includes/post-template.php at line 1796

View Source

the_password_form_incorrect_password

Filter Hook
Description
Filters the invalid password message shown on password-protected posts. The filter is only applied if the post is password protected.

Hook Information

File Location wp-includes/post-template.php View on GitHub
Hook Type Filter
Line Number 1796

Hook Parameters

Type Name Description
string $text The message shown to users when entering an invalid password.
WP_Post $post Post object.

Usage Examples

Basic Usage
<?php
// Hook into the_password_form_incorrect_password
add_filter('the_password_form_incorrect_password', 'my_custom_filter', 10, 2);

function my_custom_filter($text, $post) {
    // Your custom filtering logic here
    return $text;
}

Source Code Context

wp-includes/post-template.php:1796 - How this hook is used in WordPress core
<?php
1791  		 * @since 6.8.0
1792  		 *
1793  		 * @param string  $text The message shown to users when entering an invalid password.
1794  		 * @param WP_Post $post Post object.
1795  		 */
1796  		$invalid_password      = apply_filters( 'the_password_form_incorrect_password', __( 'Invalid password.' ), $post );
1797  		$invalid_password_html = '<div class="post-password-form-invalid-password" role="alert"><p id="error-' . $field_id . '">' . $invalid_password . '</p></div>';
1798  		$aria                  = ' aria-describedby="error-' . $field_id . '"';
1799  		$class                 = ' password-form-error';
1800  	}
1801  

PHP Documentation

<?php
/**
		 * Filters the invalid password message shown on password-protected posts.
		 * The filter is only applied if the post is password protected.
		 *
		 * @since 6.8.0
		 *
		 * @param string  $text The message shown to users when entering an invalid password.
		 * @param WP_Post $post Post object.
		 */
Quick Info
  • Hook Type: Filter
  • Parameters: 2
  • File: wp-includes/post-template.php
Related Hooks

Related hooks will be displayed here in future updates.