WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am looking for a way to make two separate register pages. One will automatically assign users up as a subscriber, while the other will sign them up as a contributor.

The only thing I have thought of so far is to duplicate the *register_new_user* function in the wp-login.php file and customize it a bit.

Any ideas? Thanks in advance.

share|improve this question
up vote 2 down vote accepted

Basically all you need to do is add an hidden field named role and set the value to whatever role you want on the register form.

function show_role_field(){ ?>
<input id="role" type="hidden" tabindex="20" size="25" value= "<?php if (isset($_GET['role'])){echo $_GET['role'];} ?>"  name="role"/>

Next thing is to register that role when the user has submitted the registration form.

add_action('user_register', 'register_role');

function register_role($user_id, $password="", $meta=array()) {

   $userdata = array();
   $userdata['ID'] = $user_id;
   $userdata['role'] = $_POST['role'];

   //only allow if user role is my_role

   if ($userdata['role'] == "my_role"){

Now all that is left to do is direct the user to the register url with the role that you want as a query var, for example


You can read more http://www.jasarwebsolutions.com/2010/06/27/how-to-change-a-users-role-on-the-wordpress-registration-form/ And i would suggest that you check to validate the role is allowed to register before saving it so you wont get a few new admins in your site.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.