[wp-trac] [WordPress Trac] #63770: WordPress wp_insert_user() throws warning when password is not provided

WordPress Trac noreply at wordpress.org
Thu Jul 31 04:44:04 UTC 2025


#63770: WordPress wp_insert_user() throws warning when password is not provided
---------------------------------------+-------------------------------
 Reporter:  sheldorofazeroth           |       Owner:  sheldorofazeroth
     Type:  defect (bug)               |      Status:  assigned
 Priority:  normal                     |   Milestone:  Awaiting Review
Component:  Login and Registration     |     Version:  trunk
 Severity:  normal                     |  Resolution:
 Keywords:  needs-patch has-test-info  |     Focuses:
---------------------------------------+-------------------------------
Changes (by rollybueno):

 * keywords:  needs-patch => needs-patch has-test-info
 * version:   => trunk


Comment:

 == Reproduction Report
 === Description
 This report validates whether the issue can be reproduced.

 === Environment
 - WordPress: 6.9-alpha-60093-src
 - PHP: 8.2.28
 - Server: nginx/1.29.0
 - Database: mysqli (Server: 8.4.5 / Client: mysqlnd 8.2.28)
 - Browser: Chrome 137.0.0.0
 - OS: Linux
 - Theme: Twenty Twenty-Five 1.3
 - MU Plugins: None activated
 - Plugins:
   * Query Monitor 3.18.0
   * Test Reports 1.2.0

 === Actual Results
 1.  ✅ Error condition occurs (reproduced). Tested on laster trunk and
 it's still happening!

 === Additional Notes
 Use the following code on your theme's function:
 {{{
 // Test wp_insert_user() warning - remove after testing
 add_action(
         'init',
         function () {
                         // Enable error reporting
                         error_reporting( E_ALL );
                         ini_set( 'display_errors', 1 );

                         echo "=== Testing wp_insert_user() without
 password ===\n";

                         // Test creating user without password
                         $userdata = array(
                                 'user_login'   => 'testuser_' . time(),
                                 'user_email'   => 'testuser_' . time() .
 '@example.com',
                                 'display_name' => 'Test User',
                         // 'user_pass' is intentionally omitted
                         );

                         echo "Creating user without password...\n";
                         $user_id = wp_insert_user( $userdata );

                 if ( is_wp_error( $user_id ) ) {
                         echo 'Error: ' . $user_id->get_error_message() .
 "\n";
                 } else {
                         echo "User created successfully with ID:
 $user_id\n";

                         // Clean up - delete the test user
                         require_once ABSPATH . 'wp-
 admin/includes/user.php';
                         wp_delete_user( $user_id );
                 }
         }
 );
 }}}

 === Supplemental Artifacts
 Result:
 [[Image(https://i.imgur.com/v6LM3si.png)]]

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/63770#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list