[wp-trac] [WordPress Trac] #63897: Generate Password button requires two clicks to update the password field on Add New User screen

WordPress Trac noreply at wordpress.org
Mon Sep 1 17:44:06 UTC 2025


#63897: Generate Password button requires two clicks to update the password field
on Add New User screen
-------------------------------------------------+-------------------------
 Reporter:  parthvataliya                        |       Owner:  (none)
     Type:  defect (bug)                         |      Status:  new
 Priority:  normal                               |   Milestone:  Awaiting
                                                 |  Review
Component:  Users                                |     Version:  5.6
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch has-test-info dev-         |     Focuses:  javascript
  feedback                                       |
-------------------------------------------------+-------------------------

Comment (by taninakond):

 Replying to [comment:9 siliconforks]:
 >
 > Note that this results in additional unnecessary AJAX requests on some
 pages:
 >
 @siliconforks Thank you for pointing this out. To avoid the unnecessary
 AJAX requests on pages where the password field is not present, we could
 wrap the AJAX call in a simple condition. For example:
 {{{#!php
 if ( $( '.wp-generate-pw' ).length ) {
     wp.ajax.post( 'generate-password' )
         .done( function( data ) {
             $pass1.data( 'pw', data );
         } );
 }

 }}}


 This way, the request will only be triggered when the relevant element
 exists on the page.

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


More information about the wp-trac mailing list