the_post_password()

In this article

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

function the_post_password() {
	$post = get_post();
	if ( isset( $post->post_password ) ) {
		echo esc_attr( $post->post_password );
	}
}

Changelog

VersionDescription
2.7.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.