Plugin Author
Dan
(@geekysoft)
Therefore a password-protected post returns both a password form and a post whether cached or not.
This sounds like a theme error.
Let’s see. So we’d want to cache password protected posts, but only when the password is not provided. I’ll do some testing, but I believe I’ll end up adding the following conditional to $noncacheable:
(!empty($post->post_password) && !post_password_required())
Plugin Author
Dan
(@geekysoft)
@stcyrill, would you please help by testing revision 1663525 (or full script file)?
@geekysoft
Thank you for repling me about this issue.
I tried a patch(revision 1663525), it’s OK after password form passed.
However, it’s contained !post_password_required() in if condition,
therefore it returns Cache-control header in password form page.
Could you remove !post_password_required() in cache_control_nocacheables?
Thank you for reading.
Plugin Author
Dan
(@geekysoft)
The intention was to return the password form unless the right password is provided. This is the public page that is accessible to anyone, right? So you’d want this to be cached. When the user is logged in and have unlocked the article, then the page is tagged as non-cacheable.
@geekysoft
Yes, the password form page is public.
However, if this page is cached, it becomes to return password form in spite of valid password because of redirection to same URL.
Thank you for reading.
Plugin Author
Dan
(@geekysoft)
However, if this page is cached, it becomes to return password form in spite of valid password because of redirection to same URL.
You need to Vary by cookie to serve different pages based on [the WordPress login] cookie. This is not a problem with the plugin.
Right. I’ll try “Vary header” way to treat a cache.
Thank you a lot.