wp_registration_url is a really straight forward function added in WordPress v3.6 that simply spits out the URL for people to register with your WordPress site.

Use it as a link like this:

<a href=”<?php echo wp_registration_url(); ?>” title=”Register”>Register</a>

(From the codex)

It’s important to know that by default, user registration is not allowed. To activate it, go to the General Settings panel (/wp-admin/options-general.php) and check the ‘anyone can register’ checkbox by ‘Membership.’

By default, new users are set to the ‘subscriber’ role.

Put it to good use

Using this function is super easy and opens up a lot of avenues. I’ve added a snippet that will give your users a login, logout, or register option depending on who your user is and the settings you’ve decided.


<?php if ( is_user_logged_in() ) { ?>

<a href=”<?php echo wp_logout_url(); ?>”>LOGOUT</a>

<?php } else { ?>

<a href=”<?php echo wp_login_url(); ?>”>LOGIN</a>

<?php if ( get_option( ‘users_can_register’ ) ) { ?>

<a href=”<?php echo wp_registration_url(); ?>”>REGISTER</a>

<?php }//if can_register ?>

<?php }//if logged_in ?>

End Code

Let’s break this down into plain English: This snippet figures out if the current user is logged in or not. If they are logged in it will provide a ‘logout’ link. If they are not logged in it will provide a ‘login’ link. If they are not logged in and they can register, it will provide a ‘register’ link.

The Functions


This function returns a boolean value (1 or 0) if the current user has logged into the site.


This logs the user out of your site, and takes them to the login screen.


This provides a link to your site’s login URL.

get_option( ‘users_can_register’ )

This will return 1 if you have enabled user registration on your site, or 0 if not.