It is currently Thu May 23, 2013 3:28 am

All times are UTC


You can access below Applications



Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Redirect to the current page url after login in wordpress?
PostPosted: Thu Apr 28, 2011 9:39 am 
Offline

Joined: Tue Mar 02, 2010 11:25 am
Posts: 190
Location: Kovilpatti
Hi

using the wp_login_url() - for getting login url, if you want to redirect to the current page after login means . use wp_login_url(get_permalink()); ,

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


the above code can include in index page ,where there loop for display all post,you may call this function .

do want to redirect to external page you have to use reidrect parameter like this

Code:

<?php
$Path
=$_SERVER['REQUEST_URI'];
$URI='http://www.example.com'.$Path;
<
a href="<?php echo wp_login_url( get_permalink() ).'redirect_to='.$URI"; ?>" title="Login">Login</a>

?>


same for logout function ,

Code:

<?php
$Path
=$_SERVER['REQUEST_URI'];
$URI='http://www.example.com'.$Path;
<
a href="<?php echo wp_logout_url( get_permalink() ).'redirect_to='.$URI"; ?>" title="Login">Login</a>

?>
Share |

_________________
Thanks,
A.ThangaSornam,

QualityPointTechnologies,
Ottapidaram.


Top
 Profile  
 
 Post subject: Re: Redirect to the current page url after login in wordpress?
PostPosted: Thu Apr 28, 2011 11:26 am 
Offline
User avatar

Joined: Tue Mar 02, 2010 10:49 am
Posts: 171
Location: India/Tamilnadu/Tirunelveli
Good post. Thanks for providing a useful post. keep post.
Share |

_________________
Anbarasan k


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron