$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 Create New Role Just to Manage Users?
- Hide ID for WordPress User Role Subscriber
- Exclude posts with specific metadata from search?
- Path for php file for inserting data through html form
- Normal PHP array for exclude section of WordPress query?
- Setting user nickname and displayname to shortened email
- Include Parent Term in wp_list_categories
- How to make an embeded a Youtube video from custom field text responsive to screen size?
- How to create pagination for users list using custom array?
- Buddypress update user avatar image via REST
- Error Uncaught ArgumentCountError i cant find it
- Function returns text instead of html [closed]
- Display Data in Table from External Database in WP using Shortcodes
- Problem changing from PHP 5.6 to PHP 7.2 [duplicate]
- is_user_logged_in() not working in AJAX validation call
- WordPress member notification
- Loop stopped working
- How to check if a Customizer setting is set?
- How does WordPress differentiate what scripts are loaded in wp_head() and wp_footer()?
- Is it best to avoid using $wpdb for security issues?
- Change order of custom submenu link in WP Admin?
- Underscore – Self hosted fonts
- Unset session variable on page reload / setup but exclude AJAX
- Download PDF after CF7 form submission
- 3 different times on my WordPress website
- Remove Custom Divs from AMP pages
- get_posts works in the page template but not in a shortcode
- deactivating an active plugin using if page
- Extend Woocommerce Widget Class – WC_Widget_Product_Categories
- Printing HTML codes
- Read array in php?
- Is it possible to return content, and then also continue to do other things?
- How to get post ID in a Page?
- Single Quotes in .php file doesn’t load website
- Separation of presentation and code – WordPress
- Register a menu – Error Header
- How to fix this warning:call_user_func_array() expects exactly 2 parameters, 1 given in D:\wamp\www\…….\wp-includes\class-wp-hook.php on line 286
- element not working in Safari [closed]
- WordPress wp_add_inline_style unable to give hex colors?
- Parse error: syntax error, unexpected ‘}’ on get_the_author_meta [closed]
- Undefined method class::construct() when creating a plugin
- Hardening uploads folder in IIS breaks images
- How to set the WordPress logo programmatically with PHP
- Widget back end radio button issue
- Can’t Query Custom Table Using $wpdb Method
- Why are the details of my todo not saving?
- How can I access string value in an array?
- Theme activation hook in php class
- Defined WordPress Memory Limit to Unlimited
- What is the proper way to include a PHP framework into my theme?
- Count posts on multisite with blog id
- how to make jpg downdable in wordpress?
- ::before on open/close function [closed]