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.
Simply head over to the Settings » General page in your WordPress admin area. Scroll down to the 'Membership' section and check the box next to 'Anyone can register' option.
All you have to do is, go to User Registration -> Settings. Now, click on the Login Options tab. Now, insert the slug of your registration page in the Registration URL box. And below that, you will find a Registration URL label option.
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()); ?>
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;
}
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?)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With