the_post_password

The timeline below displays how wordpress function the_post_password has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 5.5

/**
 * Displays the post password.
 *
 * The password is passed through esc_attr() to ensure that it is safe for placing in an HTML attribute.
 *
 * @since 2.7.0
 */
function the_post_password()
{
    $post = get_post();
    if (isset($post->post_password)) {
        echo esc_attr($post->post_password);
    }
}

WordPress Version: 4.6

/**
 * Displays the post password.
 *
 * The password is passed through esc_attr() to ensure that it is safe for placing in an html attribute.
 *
 * @since 2.7.0
 */
function the_post_password()
{
    $post = get_post();
    if (isset($post->post_password)) {
        echo esc_attr($post->post_password);
    }
}

WordPress Version: 4.1

/**
 * Display the post password.
 *
 * The password is passed through {@link esc_attr()} to ensure that it
 * is safe for placing in an html attribute.
 *
 * @since 2.7.0
 */
function the_post_password()
{
    $post = get_post();
    if (isset($post->post_password)) {
        echo esc_attr($post->post_password);
    }
}

WordPress Version: 3.7

/**
 * Display the post password.
 *
 * The password is passed through {@link esc_attr()} to ensure that it
 * is safe for placing in an html attribute.
 *
 * @uses attr
 * @since 2.7.0
 */
function the_post_password()
{
    $post = get_post();
    if (isset($post->post_password)) {
        echo esc_attr($post->post_password);
    }
}