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