• Plans & Pricing
  • Log in
  • Get started
  • WordPress Hosting
  • WordPress for Agencies
  • Become an Affiliate
  • Domain Names
  • AI Website Builder
  • Website Builder
  • Create a Blog
  • Newsletter
  • Professional Email
  • Website Design Services
  • Commerce
  • WordPress Studio 
  • Enterprise WordPress 
  • Overview
  • WordPress Themes
  • WordPress Plugins
  • WordPress Patterns
  • WordPress AI Features
  • Google Apps
  • Support Center
  • WordPress News
  • Business Name Generator
  • Logo Maker
  • Discover New Posts
  • Popular Tags
  • Blog Search
Get started
  • Sign up
  • Log in
About
  • Plans & Pricing
Products
  • WordPress Hosting
  • WordPress for Agencies
  • Become an Affiliate
  • Domain Names
  • AI Website Builder
  • Website Builder
  • Create a Blog
  • Newsletter
  • Professional Email
  • Website Design Services
  • Commerce
  • WordPress Studio  
  • Enterprise WordPress  
Features
  • Overview
  • WordPress Themes
  • WordPress Plugins
  • WordPress Patterns
  • WordPress AI Features
  • Google Apps
Resources
  • Support Center
  • WordPress News
  • Business Name Generator
  • Logo Maker
  • Discover New Posts
  • Popular Tags
  • Blog Search
Jetpack App
  • Learn more
  • Support Center
  • Guides
  • Courses
  • Forums
  • Contact
Search
  • Support Center
  • Guides
  • Courses
  • Forums
  • Contact
Forums / Cached Redirect issue

Cached Redirect issue

  • Unknown's avatar
    shoppiasc · Member · Apr 20, 2023 at 6:38 pm
    • Copy link Copy link
    • Add topic to favorites Add topic to favorites

    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)

  • Unknown's avatar
    aleone89 · Staff · Apr 28, 2023 at 1:57 pm
    • Copy link Copy link

    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.

Tags

  • .org
  • account

About this topic

  • In: Support
  • 2 participants
  • 1 reply
  • Last activity 3 years
  • Latest reply from shoppiasc

Have a question?

Get in touch
Back to Top

Couldn't find what you needed?

Contact us

Get answers from our AI assistant, with access to 24/7 expert human support on paid plans.

Browse our guides

Find step-by-step solutions to common questions in our comprehensive guides.

WordPress.com

Products
  • WordPress Hosting
  • WordPress for Agencies
  • Become an Affiliate
  • Domain Names
  • AI Website Builder
  • Website Builder
  • Create a Blog
  • Professional Email
  • Website Design Services
  • WordPress Studio
  • Enterprise WordPress
Features
  • Overview
  • WordPress Themes
  • WordPress Plugins
  • WordPress Patterns
  • WordPress AI Features
  • Google Apps
Resources
  • WordPress.com Blog
  • Business Name Generator
  • Logo Maker
  • WordPress.com Reader
  • Accessibility
  • Remove Subscriptions
Help
  • Support Center
  • Guides
  • Courses
  • Forums
  • Contact
  • Developer Resources
Company
  • About
  • Press
  • Terms of Service
  • Privacy Policy
  • Do Not Sell or Share My Personal Information
  • Privacy Notice for California Users
DeutschEspañolFrançaisBahasa IndonesiaItalianoNederlandsPortuguês do BrasilSvenskaTürkçeРусскийالعربيةעִבְרִית日本語한국어简体中文繁體中文English

Mobile Apps

  • Download on the App Store
  • Get it on Google Play

Social Media

  • WordPress.com on Facebook
  • WordPress.com on X (Twitter)
  • WordPress.com on Instagram
  • WordPress.com on YouTube

Automattic

Automattic
Work With Us
    • WordPress.com Forums
    • Sign up
    • Log in
    • Copy shortlink
    • Report this content
    • Manage subscriptions