$WP_array = array (
'user_login' => $username,
'user_email' => $email,
'user_pass' => $password,
'user_url' => $website,
'first_name' => $first_name,
'last_name' => $last_name,
'nickname' => $nickname,
'description' => $bio,
) ;
$id = wp_insert_user( $WP_array ) ;
wp_update_user( array ('ID' => $id, 'role' => 'editor') ) ;
Since you are looking for working solutions, this one should work, and it is only the helpful answer candidate. I am ware that this may not be the best solution, maybe not even close, but it should work.
Related Posts:
- Remove update nags for non-admins [duplicate]
- Allow Editors to edit pending posts but not draft ones
- How to target with css, admin elements according to user role level?
- Remove admin bar for subscribers
- Editor role cannot save custom theme options
- wordpress separate registration for different roles
- Display user role Name – not slug
- Add user settings to specific roles
- How to give new users two specific user role options upon WordPress user registration
- Hiding div based on user role
- custom user role wordpress – grant guest access to edit.php without insert/update/delete
- Do not execute If User is login as Administrator or any Specific Role
- Add post with approval by the admin
- How to keep the capability of users and disable Gutenberg editor in WordPress?
- Shortcode for Listing Users from Meta Value?
- Array to string conversion error in PHP 7.2 when returning user role as class
- Noindex subscriber author page
- Query for user roles
- How can I call a specific file (via php) by referencing the logged-in username?
- Plugin: Front-end Editor – User role specific editable content?
- Execute PHP code only with specific user role
- Edit and delete permissions pages and posts
- How to Add a cutsom slug to my custom author role
- Execute function only for specific user roles
- Allow a user or role to view drafts and previews, but not other admin privileges?
- how to create a user rule that can only manage support tickets?
- Hide payment method based on user role AND minimum cart value
- Edit a function to take different actions based on user role
- Used a code to revoke some dashboard menus for my contributors but for some reason it’s revoked me access to the editor [closed]
- How to give custom roles the capability to edit one Menu instead of every Menu
- Add another role to a user when they click a button?
- Obtain wordpress user role
- How to properly create multiple conditions to redirect users roles to different pages
- Echo Option Value Based On WordPress User Role
- Role exception for a settings sub menu
- Allow BBPress participant role to trash topics
- Custom user roles doesn’t apply changes
- Include administrator in author list
- How to connect database table to each registered wordpress user.
- Get author meta of all writers
- Switch-Case and user_role
- Forbid certain users to access a specific page
- How to lock users account until approvation
- How to create a User Role and give permission to only use Web Stories plugin?
- How to create custom user role without plugin?
- Custom Admin Menu Report for Specific User ID
- How to add custom user role into wordpress
- WordPress refuses to send mail, “…your host may have disabled the mail() function”
- Adding “Remember Me” in custom login
- How to remove a metabox from menu editor page?
- Install will not load: PHP does not have MYSQL installed
- Constructing a custom login form using ajax
- Error when requesting password reset email – wp authentication
- How to do conditional publishing?
- New Plugin Review
- Taxonomy linked to pages
- Checking for new message using AJAX and PHP. Server overload?
- WordPress Scheduled Event Request Blocking
- jQuery not defined
- dynamic page in WordPress
- How to sort posts based on the value (number) of a post’s metadata?
- Automatically create child pages and grandchild pages when saving a (parent) page
- WordPress wpform plugin submit and get multiple checked value from checkbox [closed]
- Is it possible to create a wordpress database with php code?
- Trying to get a PHP variable defined in a custom post into a javascript file. Null value. Using wp_localize_script
- Non-Closing PHP Query in WordPress Loop
- Need oop for wordpress theme? [duplicate]
- Display Youtube Time Automate from Key
- An audio player that showcase a random song from playlist every 24h [closed]
- extract serialized array to use for wp-query
- PHP Contact form
- How to use `wp_insert_post()` and `get_permalink()` functions?
- Image Attachments of an Array into Flexslider
- save metabox with new values _wp_page_template
- Need advice on theme customizer and child themes
- How to make sure relative URL works when site is not on root domain?
- xmlrpc how to check for errors
- display sticky post outside loop and exclude from loop
- remove specificly the last tag in all posts
- How to hide a child category and show his parent category
- PHP Warning: exif_imagetype
- How to detect and handle the time difference between server and user in WordPress?
- Posts title instead of Pages and Category titles – PHP WordPress
- How to change PHP variables with AJAX request in WordPress
- If Statement is Ignored?
- How to change this ajax function to submit to the default wordpress content area instead of the custom field ‘seller notes’?
- Split post or page content in two or more columns
- Use Post ID in functions.php
- Adding PHP to an if else loop
- Display only upcoming events / Show all events when archive year is selected
- Website is loading with corrupted data once a while [duplicate]
- Display a post based on its metabox selection
- WordPress Setting page can not be saved by html radio
- Calling the Next category link on an archive page – WordPress
- Custom action on comment post
- Merging two excerpt functions to work with conditions
- Custom 404 error does not always appear
- Javascript code not working – $ is not a function error
- Show post like this image in my newssite [closed]
- How do I remove spammy links in WP theme footer?