开发者

How to redirect a user to the current page when logging in or out?

开发者 https://www.devze.com 2023-03-07 02:04 出处:网络
I cant seem to get this to work. What I\'m trying to do is setup a \"Login\" link so that when the user clicks on it and logs in, it takes them 开发者_JAVA技巧back to the page they were on when they o

I cant seem to get this to work. What I'm trying to do is setup a "Login" link so that when the user clicks on it and logs in, it takes them 开发者_JAVA技巧back to the page they were on when they originally clicked the login button. I'd also like to do the same for when they press logout. Essentially I'm also stopping them seeing the dashboard at all.

Here's the code I have...

<a href="http://www.anymenu.co.uk/aberdeen/wp-login.php?redirect_to=<?php the_permalink();       ?>">Login</a>

Any help is much appreciated!


This plugin should do what you need.

Try this code:

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

精彩评论

暂无评论...
验证码 换一张
取 消