Changing Password Protected Message on Wordpress

4 replies
Hi Warriors,

I have setup a new blog at The Profit Boost and I am trying to load it with content for the new year.

I want some of my posts to be password protected, which I have managed to do as you can see. But the little message I want to change so it basically tells the visitor to subscribe so they can read the post.

I did find some info on google (an old post in the wordpress forums I think) but I followed the steps and it didn't work.

Can anyone help with this?

Thanks
Danny Clare
#changing #message #password #protected #wordpress
  • Profile picture of the author DannyClare
    Hey Jeff,

    Yup, that is exactly what I tried. It really messed up my page and panel. I can copy the code I used here if you want?

    function replace_the_password_form($content) {
    global $post;
    // if there's a password and it doesn't match the cookie
    if ( !empty($post->post_password) && stripslashes($_COOKIE['wp-postpass_'.COOKIEHASH])!=$post->post_password ) {
    $output = '

    <form action="'.get_option('siteurl').'/wp-pass.php" method="post">
    '.__("This post is password protected. To view it please enter your password below:").'

    <label for="post_password">Passwort:</label>
    <input name="post_password" class="input" type="password" size="20" />
    <input type="submit" name="Submit" class="button" value="'.__("Submit").'" />

    </form>

    ';
    return $output;
    }
    else return $content;
    }
    add_filter('the_content','replace_the_password_for m');




    I really just wanted it to basically say, whack you details in the box on the right. With this code I just pasted it into the bottom of the functions.php file and it didn't work too well....

    Thanks for your help Jeff,
    Danny Clare
    {{ DiscussionBoard.errors[374701].message }}
  • Profile picture of the author DannyClare
    Hey Jeff!

    Fantastic! You sussed it! The stupid fool I am, I didn't put it inside of the php tags LOL. Can not believe I made such a silly mistake!

    Thanks for your help Jeff, I owe you one, have a good new year!
    Danny Clare
    {{ DiscussionBoard.errors[374779].message }}

Trending Topics