Cached Redirect issue
-
I have created a custom post type that I want update with user log in security. I do this by creating a function that checks post type and !is_user_logged_in(), which will do a wp_redirect to a get_permalink(). I then added this as an action to template redirect.
If I access the website, login, and then access the custom post, it works perfectly fine. The page loads and I can see the post.
If I am not logged in and go to the post directly by clicking on a link or typing the URL to the browser I am redirected to the login page. This part works as intended. The issue is that when I log in and I try to go back to the post, I get redirected back to the member log in page. I can’t access the post. I have to close the browser to access the page using the aforementioned process.
I thought that somehow I was losing the authentication, but I added an if to the function that echoes “logged in” when logged in and it comes up on every page after logging in. I can’t see what it says on the post having the issue as I am instantly redirected back to the login page.
I want to say this is a cache issue, but doing a hard refreshdoes not fix the problem so my only guess is that a session is created during the wp_redirect or get_permalink that is causing the issue. That is why closing the browser fixes the issue but hard refreshe.
Any one have this issue as well or know how to fix it?
The blog I need help with is: (visible only to logged in users)
-
Hi there,
Apologies, but we can’t help with your issue directly because we don’t host your site on our WordPress.com managed hosting.
To explain, we are a fully managed hosting provider and use a custom server environment that is optimized for WordPress, provides built-in security and performance improvements, as well as in-house support for your site questions.
Because of the way we’ve optimized our service, we also use a customized version of WordPress that is different (under the hood) from what you use at your current provider. As a result, we do not have access to your site and are not familiar with the source of your issue.
You definitely have the option to move your site to us so we can provide in-house help, using our migration plugin: https://wordpress.org/plugins/wpcom-migration/ and the site would need to be on the business plan.
As it stands now, we cannot help since it is hosted elsewhere. The good news is that help is available here at the open-source WordPress forums: https://wordpress.org/support/forum/how-to-and-troubleshooting
The folks in that forum are more familiar with these kinds of issues and are in the best position to help. Thanks!
- The topic ‘Cached Redirect issue’ is closed to new replies.