Reputation: 16196
There is
wp_login_url
, wp_logout_url
, but what what about registration url?
Is there standard way to get link to registration? I need to display a link to registration page with further redirect to previous page.
PS I am using my theme login.
Upvotes: 33
Views: 123057
Reputation: 3035
I know this is an old question, but for anyone picking it up use wp_register().
It automatically determines if you're logged in and supplies either a link to the admin section of the site, or a link to the register form.
It also respects the settings in Settings -> General -> Membership (Anyone Can Register?)
Upvotes: 6
Reputation:
<?php echo wp_registration_url(); ?>
https://codex.wordpress.org/Function_Reference/wp_registration_url
Upvotes: 2
Reputation: 2143
2 points here
Without subfolder:
<a href="/wp-login.php?action=register">Register</a>
OR
<a href="<?php echo wp_registration_url(); ?>">Register</a>
With subfolder
<a href="shop/wp-login.php?action=register">Register</a>
Upvotes: 2
Reputation: 41
You can use wp_registration_url() any where you want to add link to wordpress registration to add the redirection url use apply_filters()
<a href="<?php wp_registration_url( apply_filters( 'the_permalink', get_permalink( $post_id ) ) ); ?>" >click to register</a>
Upvotes: 0
Reputation: 9
1st of all I'm a WP newbe.
wp_registration_url can redirect the new user back to the page he came from, buy without enforcing login on the way (I dont use auto login because i want the user to authenticate the mail).
i use instead (sample with Allow PHP in posts plugin):
<a href="[php]echo site_url('/wp-login.php?action=register&redirect_to=/wp-login.php?redirect_to=' . get_permalink());[/php]" title="Register">Register</a>
hope it helps...
Upvotes: 0
Reputation: 2087
Since 3.6, there is now a func: http://codex.wordpress.org/Function_Reference/wp_registration_url
<?php echo wp_registration_url(); ?>
You can override it with the register_url
filter.
add_filter( 'register_url', 'custom_register_url' );
function custom_register_url( $register_url )
{
$register_url = get_permalink( $register_page_id );
return $register_url;
}
Upvotes: 20
Reputation: 41
If I understand correctly you are asking for default Word Press registration page. That would be www.domainname.com/wp-signup.php
Upvotes: 2
Reputation: 4291
In case of hosting your wordpress site in a subfolder (e.g.: mysite.com/myblog
) you also need to include your site's url as follows:
<?php echo get_site_url() . "/wp-login.php?action=register" ?>
--> http://mysite.com/myblog/wp-login.php?action=register
Otherwise you will be redirected to a non-existing page
--> http://mysite.com/wp-login.php?action=register
Upvotes: 0
Reputation: 1836
The following will return the registration url:
<?php
echo site_url('/wp-login.php?action=register');
?>
UPDATE:
To get the registration url with a redirect to the current page use:
<?php
echo site_url('/wp-login.php?action=register&redirect_to=' . get_permalink());
?>
Upvotes: 55