Uses
| Uses | Description |
|---|---|
| wp-includes/formatting.php: esc_attr() | Escaping for HTML attributes. |
| wp-includes/post.php: get_post() | Retrieves post data given a post ID or post object. |
Displays the post password.
The password is passed through esc_attr() to ensure that it is safe for placing in an HTML attribute.
File: wp-admin/includes/template.php
function the_post_password() {
$post = get_post();
if ( isset( $post->post_password ) ) {
echo esc_attr( $post->post_password );
}
} | Version | Description |
|---|---|
| 2.7.0 | Introduced. |
© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/the_post_password