the_post_password

Displays the post password.

Description

the_post_password(); 

The password is passed through esc_attr() to ensure that it is safe for placing in an html attribute.


Usage

  1. if ( !function_exists( 'the_post_password' ) ) { 
  2. require_once ABSPATH . '/wp-admin/includes/template.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = the_post_password(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/wp-admin/includes/template.php  
  1. function the_post_password() { 
  2. $post = get_post(); 
  3. if ( isset( $post->post_password ) ) 
  4. echo esc_attr( $post->post_password );