Filter hook 'the_password_form'

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

View Source

the_password_form

Filter Hook
Description
Filters the HTML output for the protected post password form. If modifying the password field, please note that the WordPress database schema limits the password field to 255 characters regardless of the value of the `minlength` or `maxlength` attributes or other validation that may be added to the input.

Hook Information

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

Hook Parameters

Type Name Description
string $output The password form HTML output.
WP_Post $post Post object.
string $invalid_password The invalid password message.

Usage Examples

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

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

Source Code Context

wp-includes/post-template.php:1830 - How this hook is used in WordPress core
<?php
1825  	 *
1826  	 * @param string  $output           The password form HTML output.
1827  	 * @param WP_Post $post             Post object.
1828  	 * @param string  $invalid_password The invalid password message.
1829  	 */
1830  	return apply_filters( 'the_password_form', $output, $post, $invalid_password );
1831  }
1832  
1833  /**
1834   * Determines whether the current post uses a page template.
1835   *

PHP Documentation

<?php
/**
	 * Filters the HTML output for the protected post password form.
	 *
	 * If modifying the password field, please note that the WordPress database schema
	 * limits the password field to 255 characters regardless of the value of the
	 * `minlength` or `maxlength` attributes or other validation that may be added to
	 * the input.
	 *
	 * @since 2.7.0
	 * @since 5.8.0 Added the `$post` parameter.
	 * @since 6.8.0 Added the `$invalid_password` parameter.
	 *
	 * @param string  $output           The password form HTML output.
	 * @param WP_Post $post             Post object.
	 * @param string  $invalid_password The invalid password message.
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 3
  • File: wp-includes/post-template.php
Related Hooks

Related hooks will be displayed here in future updates.