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 trying to make a user registration form in my site's side bar. Users are able to register but instead of getting a success message, WordPress usually redirect them to 404 page.

Below is my form:

<form id="joinmaillist"   method='post'>
            <td><input type="text" placeholder="Your name here.." name="name" title="Please enter your name" required/></td>
            <td><input type="email" name="email" placeholder="Your email here.." required/></td>
            <td style="text-align:right"><input class="submitmail" type="submit" value="Join!" name="joinm"/></td>

and below is my PHP code:

if (isset($_POST['joinm'])){
    $email =$_POST['email'];

$user_id=  username_exists($user_name);

    if (!$user_id){
        $random_pass = wp_generate_password(12, false);
        $user_id=wp_create_user($user_name, $password, $email);
        header('Location:' . $_SERVER['REQUEST_URI']);

share|improve this question

Look at the code in wp-login.php (line 481 and following). There you can see how registration works.

The names of your form – email, name – are probably overwritten by WordPress. Always use prefixed names in forms to avoid collisions, eg.: ma_email and ma_name.

Prepare incoming data. Do not just write anything someone sends you into your data base. It may be dangerous.

Oh, and welcome to WordPress Stack Exchange! :)

share|improve this answer
Thanks I thought wordpress had already prepare all our inputs. So I think i should not worry but now I will be careful – Mark Adesina Mar 8 '12 at 9:34

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.