- This topic has 3 replies, 3 voices, and was last updated 3 weeks, 6 days ago by .
Viewing 4 posts - 1 through 4 (of 4 total)
Viewing 4 posts - 1 through 4 (of 4 total)
- You must be logged in to reply to this topic.
WordPress Membership Plugin
Simple Membership Plugin › Forums › Simple Membership Plugin › Login Redirection to Anchor on Page
Our entire site is behind a login using Simple Membership. I’ve got the Login Redirection plugin installed. We want to be able to send users a link to a point on a page (e.g. https://url.com/page#anchor-title). The redirection works overall, but when using an anchor link, it only redirects to the page and strips the anchor. Any advice on this? Am I overlooking something?
Thank you.
Our plugin uses WordPress’s wp_redirect() function to handle post-login redirects. Unfortunately, this function cannot preserve URL anchors (fragments). This is a browser limitation — the #fragment portion of a URL is client-side only and is stripped by the browser before the HTTP request is sent to the server, so the server never receives it.
For your use case, we recommend bypassing the standard After Login Redirection add-on and using the following action hook to implement your own custom redirect logic:
https://simple-membership-plugin.com/simple-membership-action-hook-reference/#swpmafterlogin
This gives you full control over post-login redirects, including the ability to redirect users to a specific anchor position on a page.
Thank you very much! I’ll explore this option.
This gives you full control over post-login redirects, including the ability to redirect users to a specific anchor position on a page.