I am having trouble in getting the url of the page from where I click the register link.
Scenario:
The url of the login page is:
http://abcd.com/wp-login.php?redirect_to=http%3A%2F%2Fabcd.com%2Fxtreme%2F&page=1406
And I when I click register link it should add the redirect_to link in the register page like this:
http://abcd.com/wp-login.php?action=register&redirect_to=http%3A%2F%2Fabcd.com%2Fxtreme%2F&page=1406
I have used the following code but its not taking redirect_to parameter:
add_action( 'registration_redirect', 'redirection_link' );
function redirection_link( $redirect_to ) {
wp_redirect($GLOBALS['HTTP_SERVER_VARS']['REQUEST_URI']);
exit;
}
You are definitely on the right track; just add a filter (not action!) to your
functions.php
and pass in theredirect_to
parameter (no need forwp_redirect
). As soon as the user has submitted the registration form, there will be a redirect to the new page:Update: To perform a hard/permanent redirect to another page you can go with an wp_redirect like this:
Update 2: You can also pass in additional parameters (e.g.
redirect_to
) if you modify the defaultregister_url
:Update 3: You can update/reset the
registration_redirect
to your newregister_url
(from Update 2) like this: