Link to registration page in Wordpress

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.

Answers


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?)


<?php echo wp_registration_url(); ?> 

https://codex.wordpress.org/Function_Reference/wp_registration_url


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


If I understand correctly you are asking for default Word Press registration page. That would be www.domainname.com/wp-signup.php


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...


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>

2 points here

  1. Make sure you have turn on the "Anyone can register" in the setting page
  2. if you host in a subfolder, make sure you include

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>

Need Your Help

Iterate over the first n elements of an array

ruby arrays

How can I iterate up to four objects of an array and not all? In the following code, it iterates over all objects. I need only the first four objects.

Render a variable as HTML in EJS

node.js express ejs

I am using the Forms library for Node.js (Forms), which will render a form for me on the backend as so: