I figured out the fix on my own, after many try and errors. I just change this line of code:
$status = wp_create_user( $username, $password, $email );
to this:
$status = wp_insert_user( array ('first_name' => $first, 'last_name' => $last, 'user_pass' => $password, 'user_login' => $username, 'user_email' => $email, 'phone' => $user_phone, 'role' => 'subscriber' ) );
It’s working fine!
Related Posts:
- Transaction when using WP functions rather than vanilla SQL?
- How to get the list of WooCommerce product image of a certain category from database?
- How to make WordPress plugin check for database changes and then do something?
- How to Join two tables from separate databases within WordPress
- Would manually deleting the dumping data fix a “#1062 – Duplicate entry ‘1’ for key ‘PRIMARY'” phpMyAdmin error?
- register_activation_hook isn’t adding table to DB
- What SQL / WordPress queries would need a nonce?
- Importing Geo data into wordpress database
- WP_Query adds “(wp_posts.ID = ‘0’)” so no results are returned
- $wpdb->insert() does not Insert record in a table
- Use $wpdb or other PHP script method to find/replace in WP database
- How can I add a new row in a separate database when someone registers via WordPress?
- Pull MySQL data from multiple tables and merge into 1 PHP array
- Use variable in SQL statement
- mySQL queries are executed twice on wordpress website
- making php value numeric
- Database SQL query error
- How to run complex query using PHP
- SQL Query Search page
- can’t delete a row from post_meta table
- Conditional statement within WP SQL query
- Undefined function mysql_connect()
- MySQL “Or” Condition
- SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax — PHP — PDO [duplicate]
- Can i use php sql functions instead of $wpdb?
- How to validate WordPress generated password in DB using PHP?
- Custom query to get post names beginning with a digit
- How To Make Connection To WordPress Data Base In A Plugin?
- How to auto login user again after change user_login
- count number of user comments with a specific comment meta value
- Jquery ajax to custom php file: returning blank data
- Add value to usermeta without removing previous values?
- How can I call a row of user specific data from a custom table added to the WP Database
- How to track a users progress through pages by inserting data into WordPress Database?
- the_author_meta not working
- my function doesn’t return my post from today
- Performance issues with large website [closed]
- Create a quick start wordpress installation [closed]
- How to migrate the posts from an old custom legacy blog to a new WordPress website?
- theme options echoing multiple times
- WordPress 3 – how are passwords stored and how do I compare to them?
- mysqli_real_connect() – authentication method unknown to the client Warnings
- how to echo all tables that start with a prefix
- Do I need to prepare query before get_results(), get_row() and get_var()?
- How to create and work with custom data / tables (i.e., for arbitrary data)?
- Get Current User Id Inside a Loop Returns 0 For a Shortcode
- Get stock by custom meta field on all Woocommerce variable products
- Transferring working local PHP site to wordpress – with database (MySQL)
- Display fields as values in array from external SQL DB
- Accessing data from a non-WP database/table within a page content
- I want to select the from values from database in WordPress? [closed]
- User management system similar to wordpress one?
- Detect session/cookie variable in wordpress to prevent access to documents
- SQL Injection blocked by firewall
- Ordering users by custom user meta
- Long running queries
- Multiple meta_key in one global $wpdb;
- Custom array from a query only write the last row of the query
- WordPress member notification
- Moving wordpress site from localhost to live server using GoDaddy cPanel
- How does WP work in conjunction with a web server?
- WordPress Block developer from exporting Database via PHP
- How do I display offsite database info on my wordpress site?
- Most commented posts by time period (last 12h, last 24h and etc)
- Issue with fetching mysql data and displaying results via shortcode in webpage
- Custom route and query
- How to unserialize data from MySQL
- PHP -> SQL Query with Summing
- Known Issues in WordPress When Upgrading PHP to ver 7
- Edit Account – read and write to MySQL
- Why when I create a new post I found 2 record related to this post into the posts database table?
- Most viewed posts in WordPress
- Remove password protection from all posts
- wordpress sql posts query won’t display the latest post in a specific category
- Display latest post from WordPress Featured Category that is also in X,Y,or Z categories
- SQL error with custom query
- Modify WooCommerce used to get all orders in dashboard
- What’s wrong in my PHP code? I’m using WordPress Astra Theme and I can’t insert data into my SQL
- Get mysql data for Quick Edit panel
- WordPress SQL Prepare
- Fetch Data from an external MSSQL Database in a Managed WP hosting
- How to get database connection details without longing to cpanel in WordPress?
- Weird fonts showing which are coming from database
- WordPress Bad Request Error 400
- I am facing this error Your PHP installation appears to be missing the MySQL extension which is required by WordPress
- cant insert data in a custom table in phpmyadmin
- Change upload URL by mime type
- autocomplete in wordpress using ajax with json-data
- Unexpected behavior when trying to manually install WordPress on macOS Sierra
- WordPress post insertion from PHP file
- Query doesn’t display text data with apostrophes
- I want show only data for today
- Getting error in sql query
- MySQL queries in WordPress
- Let users register weight each day and save it in DB
- How to export database correctly for local to online
- How to pass username into form that sends data to database
- Your PHP installation appears to be missing the MySQL … After deleting and restarting from cpanel
- SQL query to retrieve the number of WordPress posts with all given categories
- running an existing WordPress site from Visual Studio Code?