the_post_password() WordPress Function

The the_post_password() function is used to display the password form for a post. This function must be used within The Loop.

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.


Top ↑

Source

File: wp-admin/includes/template.php

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


Top ↑

Changelog

Changelog
VersionDescription
2.7.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.