Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialSusan Siow
6,497 PointsLogin Redirection to Current Page Snippet
Does anyone has a function snippet which can redirect WP users to their current viewing page when they are login?
2 Answers
Mike Bronner
16,395 PointsTry this: http://codex.wordpress.org/Function_Reference/wp_redirect
<?php
wp_redirect( $location, $status );
exit;
?>
As long as you know what page they need to be redirected to, this should do that.
henrikh
3,666 PointsSusan Siow
6,497 PointsBut I need the full code of the redirection for function.php and I don't think it is as easy as below:
<?php echo wp_login_url( get_permalink() ); ?>
Please help.