Home Experience & Tips Sharing Standard Post

Standard Post

WordPress Redirect to Current Page After Login Code

Naibabiji uses the paid reading plugin from Lightning Blog. By default, if you have already purchased a paid article and visit the site again, you will be prompted to log in. However, after logging in, you will be taken to the user center, not the article page you were reading. So we need to modify the plugin to redirect to the current article after login. <a href="<?php…

Published on August 29, 2020 About 1 minute read
WordPress登录后跳转到当前页代码

Naibabiji usesLightning Bo's Paid Reading Plugin. By default, if you have already purchased a paid article and visit the site again, you will be prompted to log in. However, after logging in, you will enter the user center and not be redirected to the article page you were reading. Therefore, we need to modify the plugin to redirect to the currently reading page after login.

<a href="<?php echo wp_login_url( get_permalink() ); ?>" title="Login">Login</a>

By replacing the current login code with the code above, you can achieve a redirect to the current page after login.

Official reference: https://developer.wordpress.org/reference/functions/wp_redirect/

2.4/5 - (10 votes)
Previous [Genuine Theme] Impose, a Clean and Simple Responsive WordPress Blog Theme Continue reading content around the same timeline. Next WordPress Restricts Allowed Email Types for Registration (Email Blacklist/Whitelist) View the next related tutorial or experience.

AI Website Building Assistant

🤖
Hello! I am the Naibabiji AI Assistant. How can I help you?
Quick Consultation: