WordPress password protected pages

I am hoping someone can help me this this problem.

I know how to password protect a page in wordpress admin area, in the edit page area, edit the visibility and set it to password protected. I want to know if there are wordpress php functions to check if the user typed in the correct password in the layout php file. It seems to only show the password input box if is in your layout. I am showing alot more content than just from the wordpress post in my layout. I want to be able to check if the user has already typed in this password and then show the rest of this content.

Read More

Now as I was writing this, I thought up one idea, it doesnt use any wordpress functions. I could potentially check the cookie that wordpress sets for this, just check if the cookie exists and then we know the person is logged in. This is assuming that the password protected pages use cookies.

Any help on this is appreciated.

Thanks,
Ian

Related posts

Leave a Reply

1 comment

  1. You should check the sessions rather than the cookies. It seems unlikely that WordPress would check your login status in a cookie since they are so easy to fake. It might check for an encrypted password in the cookies and log in using that, and then create a session.