I search a solution to change the text on my protected page:

This post is password protected. To view it please enter your password below:

I've found this filter hook and I included it into my functions.php in my theme.


But this code doesn't work for me.

I can't find any another solution and I don't want to edit my page template.

Any ideas how I can solve this?

Thank you.


This text comes from my theme .po file.

bumped to the homepage by Community yesterday

This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.


I use the wordpress theme wpcasa and the theme change the standard text of wordpress.

So I included a filter hook of the theme:

add_filter( 'the_password_form', 'wpsight_password_form_dmd' );

function wpsight_password_form_dmd($output){
    global $post;
    $output = '';
    $aktuelleseite = $_SERVER['REQUEST_URI'];
    $sprache = explode('/',$aktuelleseite);  

    $label = 'pwbox-'.( empty( $post->ID ) ? rand() : $post->ID );

    $output = '<form action="' . get_option( 'siteurl' ) . '/wp-login.php?action=postpass" method="post" class="form-password form-inline">';
        case 'en':
            $output .= '<p>Please include your password which we sent you.<br><br>You do not have a password? Than make a request <a href="/en/top-ten-request-form/"><u>here</u></a>.</p>';
        case 'de':
            $output .= '<p>Bitte geben Sie hier Ihr Passwort ein, welches wir Ihnen gesendet haben.<br><br>Sie haben kein Passwort? Dann fordern Sie <a href="/de/top-ten-zugangsformular/"><u>hier</u></a> eins an.</p>';
    $output .= '    <label for="' . $label . '">' . __( 'Password', 'wpsight' ) . '<input name="post_password" id="' . $label . '" type="password" size="20" class="password span3" /></label><button type="submit" name="Submit" class="btn">' . esc_attr__( 'Submit', 'wpsight' ) . '</button></form>';

    return $output;    

Now it works everything fine.

  • Please take your time and make sure your posts are properly formatted before posting so that others don't have to clean your mess ;-) – Pieter Goosen Mar 17 '16 at 11:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.