Documentation

How can I deploy a WordPress site with a specific user and role?

Last Updated: June 20, 2024 11:55 AM

By default when a site is created it is created with one administrator user. The details of this user are generated for you. It is possible that you have a use case where you wish for a particular user to be created at deploy time. In order to do so you can follow these steps:

1. Add Custom Role to Blueprint

If you the user you wish to create needs a role other than Administrator or Editor, you will need to define it in your blueprint. You can do this in your CHQ dashboard by navigating to your blueprint and opening the setup page. There you will find the option to define the name and slug of the role you wish to use.

2. Create Role on Blueprint

Ensure the Blueprint contains the role you wish to use. If you need to create a custom role on your blueprint, be sure to take a snapshot of your blueprint afterwards.

3. Deploy Site

Within your CHQ Dashboard, navigate to Sites and then Create Site. On the create site screen, select the blueprint you wish to use, and then open the advanced options. You will then be presented with additional form fields where you can provide details of the user you wish to create and the role that user will be given.

The deployed site will be deployed with 2 users. One super user which is the user you will login as using the One-Click login, and the second additional user that has the details you have provided.

|| Note, the custom roles are currently only working for CHQ and not for the Hub.