How are you all? I hope all of you are fine. I came for you with a new post. I hope it will work for all. Today we will learn “How to redirect in previous page after log in“. Those who have missed my previous post for them, I gave that posts link.
How Does A User Redirect To His Previous Page After Login?
- How to improve excerpt function in WordPress?,
- How to force a WordPress site to redirect HTTP to HTTPS for securing the whole site?,
- If the search results are only in one post, then how to redirect in that post?,
- How to upgrade WordPress comparatively in slow server?
When you make a site in WordPress then many times visitors have to redirect in previous page after log in. In today’s tutorial, we will learn how to redirect in previous page for visitors after log in.
An awesome function of WordPress is wp_login_url(). This function instructs URL of the login page of the dashboard. It can accept a parameter. In which URL, it can redirect successfully.
We can go back to present a page through using permalink() parameter.
Paste following code in your favourite place.
<a href="<?php echo wp_login_url(get_permalink()); ?>" title="Login">Login to view</a>
Thank you for reading this article. I hope this post will work for you. If there is any mistake, then forgive me. If you face any problem, then don’t forget to comment. If you think the article is beneficial then obviously share it. Stay with The Mental Club for more information.