• I am wondering how to change the password protect text on a page on my WordPress site?

    Currently the protected page displays: “This content is password protected. To view it please enter your password below:”

    I have tried looking through my coding and found nothing to edit it! Does wordpress not allow for the text to be edited?

    Help would be appreciated!

    I am currently running the newest version of wordpress and I am using the Academica theme.

Viewing 11 replies - 1 through 11 (of 11 total)
  • Moderator t-p

    (@t-p)

    Have you tried editing it in the dashboard with the admin account?

    related https://www.ads-software.com/support/topic/how-do-i-change-password-protected-text?replies=25

    or alternative code, to be added into functions.php of a child theme of your currently used theme:

    add_filter( 'the_password_form', 'custom_password_form_text' );
    
    function custom_password_form_text( $text ) {
    	$text = str_replace( 'This content is password protected. To view it please enter your password below:', 'your text', $text );
    	return $text;
    }

    for theme specific details, please ask in https://www.ads-software.com/support/theme/academica#postform

    Thread Starter tylerphillips1

    (@tylerphillips1)

    How do you create a child theme? Tried looking it up and the process is confusing!

    Can you be more specific for a coding newbie like me XD

    Moderator t-p

    (@t-p)

    I can say there is a better more direct approach.
    go to your host account where you host WP folder > wp-includes > post-template.php > scroll down to line #1663 (at least that is the location for me)
    You will find the password block of code. Follow method below to add mailto: or change the language within:
    line #1663 look like this, change content located between <P> tags:

    function get_the_password_form( $post = 0 ) {
    $post = get_post( $post );
    $label = ‘pwbox-‘ . ( empty($post->ID) ? rand() : $post->ID );
    $output = ‘<form action=”‘ . esc_url( site_url( ‘wp-login.php?action=postpass’, ‘login_post’ ) ) . ‘” class=”post-password-form” method=”post”>

    <p>’ . __( ‘This content is password protected. Your note here:‘ ) . ‘</p>

    <p><label for=”‘ . $label . ‘”>’ . __( ‘Password:’ ) . ‘ <input name=”post_password” id=”‘ . $label . ‘” type=”password” size=”20″ /></label> <input type=”submit” name=”Submit” value=”‘ . esc_attr__( ‘Submit’ ) . ‘” /></p></form>
    ‘;

    Your note here’ = <a href=”mailto:youremail@blah.com” </a

    Supra-D, thanks for the detailed info. I put this to practice on a test site and it worked well. Also a suggestion for others if you just want to remove the word “Protected: ” and just have the title show up, go to line #130, and delete the word Protected and the colon. You can search for it using without quotes, “Protected: ” in your favorite text editor program.

    $protected_title_format = apply_filters( 'protected_title_format', __( 'Protected: %s' ), $post );

    Hi there! Will this customization be retained once wordpress is updated? Thanks…

    Alhamshazad – not Supra-D’s method. You need to add to your theme’s functions.php file. Take that route for protection against WordPress updates.

    theatereleven is correct, You would need to redo this process with new WP updates, so he recommends a direct solve for it.

    And thanks Mark!

    Its just my personal preference to target the source code rather then going through the theme’s functions. ALWAYS BACK UP YOUR CODE. Change at your own risk. If you leave out a bracket or parentheses — you will break the code. And then may have to reinstall WP or replace the whole file being targeted.

    I have changed the BG color in my theme’s style — therefore I had to change the default color of the text as well as a custom password message color. Below, I was able to override it with inline code adding style tags: Note I added (3) STYLE tags

    The line number has changed… I now scrolled down to line #15??
    go to your host WP folder > wp-includes > post-template.php >

    function get_the_password_form( $post = 0 ) {
    $post = get_post( $post );
    $label = ‘pwbox-‘ . ( empty($post->ID) ? rand() : $post->ID );
    $output = ‘<form action=”‘ . esc_url( site_url( ‘wp-login.php?action=postpass’, ‘login_post’ ) ) . ‘” class=”post-password-form” method=”post”>

    <p style=”color:white;”>’ . __( ‘Thanks for stopping by. The Projects page is password protected, enter it below or email me to request one:’ ) . ‘</p>

    <p><label for=”‘ . $label . ‘”>’ . __( ‘Password:’ ) . ‘ <input name=”post_password” style=”color:white;” id=”‘ . $label . ‘” type=”password” size=”20″ /></label> <input type=”submit” style=”color:white;” name=”Submit” value=”‘ . esc_attr__( ‘Submit’ ) . ‘” /></p>

    </form>
    ‘;

    [moderator note and warning: IT IS NEVER A GOOD IDEA TO EDIT WP CORE FILES]

    Moderator t-p

    (@t-p)

    Hello guys,

    if you noticed this is 10-MONTH old thread!!

    If the troubleshooting already posted made no difference for you, then, as per the Forum Welcome, please post your own topic.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Password Protected Page – Text Change’ is closed to new replies.