Do you run a membership website using WordPress as your platform?

Or do you maintain your users for your web application on WordPress because of its ease of use and other features provided out of the box?

In that case, you might have come across times when you needed to add users to your wordpress remotely and without much hassle. WordPress is a very powerful tool and comes with a bunch of APIs that you can use to achieve this functionality, i.e. create a user remotely. However, there is one easy way for you to do it, without having to write complicated codes. You can use JSON API to create users on WordPress.


What Will You Need..

The first step to do is to install WordPress JSON API plugin. The next step is to install another plugin known as JSON API User. Once you install both of these plugins, you will see “JSON API” under WordPress settings. JSON API User offers a bunch of options to fetch posts, add comments etc. and the JSON API User plugin that depends on the JSON API Plugin adds an icing on the cake by allowing you to remotely create users as well. So, on the settings page for this plugin, activate the “User” creation option and save your settings. Below it you will see an API base URL which by default is api. Change api to something that is hard to guess, something like sdf23234sdf and save the settings. Now you are ready to roll.


4 Easy Steps To Go

  • The first step is to get the nonce ID which is required to create a new user remotely. To obtain this ID, open the the URL in the following format:
  • Here replace domain with your domain name and api with the api base you created in the earlier step. This will give you the nonce id in the following format:{“status”:”ok”,”controller”:”user”,”method”:”register”,”nonce”:”92d7431951″}
  • Now copy the nonce ID which in the above case is 92d7431951(Note that this ID needs to be generated every time you need to create a new user, its not static).Now use this ID in the following URL format to create a new user:[email protected]com&nonce=NONCEID&display_name=John
  • Make sure to replace domain, APIBASE and NONCEID with the appropriate ones.
  • Now when you open the above URL, you will see a message saying that the user has been created.

Thats it. This will create a new user with the role that has been set up as default in your wordpress environment. By default, its “Subscriber” but you can change it to other roles from the Settings>General page using theNew User Default role dropdown field.

Thats it, now you can use simply send a request via s URL and a new user will be instantly created in your wordpress installation.


How Can We Use This?

Now there are several reasons to hit any API and bring about tremendous developer applications to a service. However, if we sit down to ponder. How can we really use the WordPress JSON API to yield fruitful uses./

This is what we can use it for..

We can use the WordPress API to remotely add users to our wordpress website/platform and completely automate user creation when we are scaling the hiring process of the company. Now, obviously we can definitely add users to the website using the smooth User Interface provided by WordPress dashboards. But think about it, How about we could perform some of the redundant tasks that are needed to be done repetitively on just a click of a button.

One hack application to this is that we can hit the JSON API on a Google Sheet Script editor(Google Apps Script) and create a complete scale addition application for our wordpress website.

Curious to know more about Google Apps Script and it’s potential?

Check out – Google Apps Script For Business

Categories: Drupal


Leave a Reply