How To Password Protect Part of Post or Page

Posted on 17 July 2009

Have you ever wanted to password protect part of your blog post or page, but display some content as well? This little wordpress plugin allows you to show part of a post or page and then keep a portion password protected. Password protecting a post is easy, it’s the showing of partial content that’s tricky. This is not about password protecting part of your website, but part of a post.

I’ve been looking for a solution to this for awhile now.

I have a very popular natural health and weight loss website which publishes a monthly newsletter. Subscribers to that newsletter get my free report “How I Lost 300 Pounds – How To Lose 10 Pounds a Month, Every Month, Until You Reach Your Goal Weight”. Those who follow the directions in the report often go on to report that they’re getting the results and losing the weight while feeling much better. The free weight loss report is a way for me to offer some really great content in exchange for an email address.

I’m sure you might be in the same situation.

So, in giving them a place to download the material, on my download page, I also want to offer other reports to the general readership. In offering other reports of value, it’s a way to show them that by subscribing, the get the “big one”.

I wondered “how do I password protect part of a post or page?” but not the rest.

Apparently it can’t be done.

Until I found this plugin: Password – Partial Post Protection (which didn’t work out of the box as claimed I might add). On that page, half way down it is the link. It’s tucked in between a few other wordpress plugins but a little hard to see if you just scan over it.

password protect part of post or pageWhat it does is add a little box above your publish section in the upper right hand corner of your write post page in your wordpress admin. It uses shortcodes as you see in the image and everything within the shortcodes becomes password protected.

Code Is Broken Though

It’s a single file and out of the box it wont work. In order for the form to submit the password back to the page for authentication, you have to press the submit button (obviously), but the <input> field for the submit button uses type=”button” which does not submit the form.

Line 67 has to be changed from <input type=”button” ……..> to <input type=”submit” …..>

Have a look at how it works:

The next section of this post is password protected!
(password is “test”)


And this part is now visible again:
And this part below the password protection is again available to readers without the password.

This first solution does not make use of the built in password protection feature of wordpress.

A Second Solution

Funny enough, after looking for a solution to this for hours, I happened to read over the sitemap of a page I had open in a tab in my browser and found another solution to this. I haven’t tried his show the intro to password protected posts wordpress plugin, but I’m running a few others from him.

This second solution makes use of the <-- more --> tag and actual wordpress post password protection.

Seems to me that the first solution using short codes is a bit easier.

So there you have it. If you want to know how to password protect part of a post or page in wordpress, these two plugins may do the trick for you as they have for me. Now, I can move forward and create the download page for my readers that hides the bonus report until the subscribe for the password.

12 Comments For This Post

  1. Ray says:

    Great article.
    Was looking for something like the first solution.

    Not sure if it uses the built-in password protected post function though…

  2. Takahashi Conspiracy says:

    You have no idea how much you are loved for posting this…

    This has been a horrible thing to try to figure out for a friend and I who are using WordPress – although some of the stuff that is protected is actually free stuff, it requires a password to prove you’re an adult. Which is extremely important, obviously. But who even wants to bother getting a password for it when you can’t see what the rest of the post is about?

    We were so happy that WP allowed password locking, without membership, but very unhappy when it made everything simply state protected post instead of an excerpt of what you’d get if you bothered having a password. >_<

    So… thankyouthankyouthankyou! Now I can actually post stuff and not put a seperate page that lists what is in each with a link to each post, which would be SUCH a nightmare.

  3. Seti says:

    You have no idea how long I was looking for that first solution (the second doesn’t change the search results, which I needed)… Thanks a bunch. :]

  4. bob tomorrowland says:

    Hey Rob,

    Do you know of a WordPress plugin that allows me to password-protect my posts for multiple users? In this scenario, one user would have a password to give them access to certain posts, while another user has a different password to see a different set of posts. Is this even possible?

    Many thanks!


  5. Rob says:

    @Bob, based on what I’ve seen when I was researching this, no, nothing out of the box that simple. Sounds pretty custom to me.

  6. Ritchie says:

    Hey Rob, thank you very much for this great solution! Got one question though, if it’s possible to change the name of the submit button? Thanks in advance.

  7. Elise Davidson says:

    […] you can use the built in features. But, if you want to show part of a post and keep part of a post password protected, that was never possible before […]

  8. John says:

    RE: Password – Partial Post Protection – Plugin. Would you happen to still have this code? It’s exactly what I’m looking for …

  9. Niall Flynn says:

    Drop this into your functions.php for your theme.

    // Password Protected Page Message
    function custom_password_form($form) {
    $subs = array(
    ‘#This post is password protected. To view it please enter your password below:#’ => ‘Hopefully this works.’,
    ‘##’ => ”,
    ‘##’ => ”,
    ‘##’ => ”

    echo preg_replace(array_keys($subs), array_values($subs), $form);

    add_filter(‘the_password_form’, ‘custom_password_form’);

  10. Megi says:

    Do you have correct link to Partial Post Protection plugin? Thx :)

  11. Rob says:

    @Megi, I don’t. Thanks for the heads up to the broken page.

  12. Mel says:

    Hi! I have a problem and I would be very grateful if you help me!
    I don’t have a domain, and I haven’t wordpress installed on my computer. I only have a blog like
    how can I partially protect my posts by password?

4 Trackbacks For This Post

  1. Wordpress Password Protection | iSeekArticles says:

    […] posts or pages is built into the functionality, but being able to show part of the post, and then password protect part of a post is another thing all […]

  2. Wordpress Plugins For Password Protection | Announced Blogs » Blog Archive says:

    […] you can use the built in features. But, if you want to show part of a post and keep part of a post password protected, that was never possible before […]

  3. Top WordPress Plugins 2011: Honorable Mentions says:

    […] plugin is no longer supported, but you might be able to get help over at Your Members Forums or on Rob Cooper’s blog post about the plugin. You can also try Password Content ShortCode [link] by ZetRider which works about the same. […]

  4. Password Protected Blog Post : Skype for Business | Income Assurance With Skype says:

    […] is a Plugin to logout of password protected posts (great for […]

Leave a Reply