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.


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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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