computer support

Sending links to password protected pages in WordPress

Update  16JAN13 – the older post blow  is now invalidated.

The solution you seek is now the Post Password Token plugin, which is a FREE plugin on WordPress.  Donate $10 if you like it !  I did.


Old solution


So if you are reading this, you already know how to click the password protect button in WordPress. But what you are really wanting to know is how to send a link to someone, with the password option already embedded. Say a client who isn’t going to remember his password.

First, you probably searched WP looking for the #@$! plugin that does this. No luck.
Second, you’ve realized that you’ll have to either install a ‘membership’ style plugin or tweak htpaccess code.
Third, you’ve found my humble musing with a promise of an elegant solution.

Well, i’m hitchhiking off of
who really solved it, but made a typo just at the finish line and screwed up the answer.

So use your friendly ftp program to log into your website, download the /wp-includes/post-template.php and look for function post_password_required about halfway down.

insert this little snippet near the top.

if ( $_GET[‘get_password’] == $post->post_password )
return false;

so it looks like

function post_password_required( $post = null ) {
$post = get_post($post);

if ( $_GET[‘get_password’] == $post->post_password )
return false;

if ( empty($post->post_password) )
return false;

if ( !isset($_COOKIE[‘wp-postpass_’ . COOKIEHASH]) )
return true;

if ( $_COOKIE[‘wp-postpass_’ . COOKIEHASH] != $post->post_password )
return true;

return false;

SAVE THE FILE locally. On the server, save the old file post-template.php as post-template.php.old (in case you screw up, you can roll back).

UPLOAD the new file post-template.php.

And now send the link as

it pulls up like a public page.  Note that once it pulls up, that I think a cookie is set, and it keeps showing. So you’ll have to test on a 2nd computer that hasn’t entered the password before.




Note! 4/23/12 – WordPress updates will wipe out this file. So you need to save a copy of this file as post-template.php.working and then after an update, replace the post.template with the post-template.php.working after EVERY wordpress update.


BTW, this is really really handy for delivering ebooks from Clickbank so you can control access to the files.



8/1/2012 recent WordPress updates changed this and this solution is no longer valid. now the best thing to do is simply hide the page to deliver the product.