javascript - how to use jquery validate .js in wordpress for user name already exist?


Hi I am making a registration form in myWordPress site

this is the code:



function reg_register(){

$userdata = array(
     'user_login'    =>  $user_name,
        'user_email'  => $user_email,
        'user_pass' =>  $pass

 $user_id = wp_insert_user( $userdata ) ;



<script type="text/javascript" language="javascript" src="<?php bloginfo('stylesheet_directory');?>/js/jquery.validate.js"></script> 
  <script type="text/javascript">

My registration form is working correctly with validation. (i.e. this field is required, please enter a valid emial etc) Now i need to make a validation that this username is already exists. How to do that. Please help




On the server side you can validate wether or not a user exists by using the


In addition, inserting a user manually into the database is not recommended as WordPress provides an interface for this functionality via

wp_create_user( $username, $password, $email );

To see how to implement it in validate.js (you need output the desired javascript , it via php), see

People are also looking for solutions to the problem: How to create a highchart using mysql data (PHP)?


Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.