Make WordPress Core

Opened 4 years ago

Closed 2 months ago

#49416 closed defect (bug) (duplicate)

Deleting a user when having thousands of users

Reported by: alexjones's profile alexjones Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Users Keywords:
Focuses: administration, performance Cc:


If you want to delete a user from WP-Admin and your WordPress installation has a very large number of users(a large Woocommerce shop for example) on the delete page it takes a lot of time to load all the users. The page stops working in some cases(like when you have 20k users) as it tries to load all of them on the page and the Confirm Deletion button doesn't work.

It would be helpful to have just a search field there and to not load any user if you don't want to attribute the content to another user. Some users request the deletion of their account from certain websites for privacy reasons and other and this task becomes tedious.

Change History (10)

This ticket was mentioned in Slack in #forums by carike. View the logs.

4 years ago

#2 @audrasjb
4 years ago

  • Keywords reporter-feedback added

Hi, welcome to WordPress Trac and thank you for the ticket,

The users screen query is paginated so it shouldn't take so much time. Also there is already a search field in this screen so I don't see how this could be improved.

#3 @carike
4 years ago

  • Resolution set to invalid
  • Status changed from new to closed

Hallo, Alex.

WordPress Trac needs reproduce-able steps to confirm a bug.
Screenshots can help a lot.

Are you aware of the tools available in WordPress to handle deletion requests?
Deleting accounts from the Users screen in wp-admin is not best practice.
You can find more information here:

If you need assistance using the privacy tools, you can post a question here:

#4 @ocean90
4 years ago

  • Keywords reporter-feedback removed
  • Resolution invalid deleted
  • Status changed from closed to reopened

This report is about the use of wp_dropdown_users() to assign the content to new users. wp_dropdown_users() is known to be not scalable, see #19867.

#5 @carike
4 years ago

Wow, that ticket is 5 years old.
Will discuss during #core-privacy office hours in Slack tonight if there is a possible alternative to


that can be implemented during the deletion request to assign items to a different user, @ocean90

This ticket was mentioned in Slack in #core-privacy by carike. View the logs.

4 years ago

#7 @xkon
4 years ago

There's nothing related to the privacy tools within this report or #19867 @carike and it's not relevant with the Erasure requests. Erasure requests do not delete users, they just erase parts of the data that are not needed.

This is in regards to how the actual User Delete process / ui is handled (again not data erasures).

Just my 2c to avoid confusion on further replies :-).

#8 @carike
4 years ago

I trust your opinion on the matter that it will cause a different set of problems if user deletion is included with the data erasure, as discussed in Slack, @xkon :)

"Some users request the deletion of their account from certain websites for privacy reasons"

@alexjones Deleting users when you have an e-commerce store is not considered best practice, as there are mandatory record-retention periods in most jurisdictions for tax purposes, among other things.
This being said, of course I can't and won't try to dictate what other people do on their sites.
Trac isn't the best place to deal with those sorts of considerations though, so I really do encourage you to visit the forums and discuss the matter there, if you are looking for alternative solutions.

And, with that, I send :fourleafclover:s and :coffee:
Best of luck, everyone :)

#9 @Mista-Flo
4 years ago

That's an interesting ticket, I'm not sure why the user-suggest.js is only used on multisite. In the AJAX action, you have this code:

        if ( ! is_multisite() || ! current_user_can( 'promote_users' ) || wp_is_large_network( 'users' ) )

        if ( ! current_user_can( 'manage_network_users' ) && ! apply_filters( 'autocomplete_users_for_site_admins', false ) )

If I just comment these two if states, create a new input text in


                if ( $users_have_content ) {
                        add_action( 'admin_head', 'delete_users_add_js' );

                        wp_enqueue_script( 'jquery-ui-autocomplete' );
                        wp_enqueue_script( 'user-suggest' );


                                <input type="text" id="reassign_user_new" class="wp-suggest-user" name="reassign_user_new" data-autocomplete-type="search" />

It works well. Of course, you would need to update a bit because a user ID is expected by the original field, and I would prefer to use the REST API, but it can do the trick.

I don't understand why in multisite it doesn't accept the suggestion if it's a large network, does that mean you have to enter the exact email/username of the user without any possible search?

I have also tried another implementation, by looking at tags-suggest.js (but it's still a draft, the suggestions are not displayed), so given an input text field:

	var user_endpoint = '<?php echo rest_url('wp/v2/users/'); ?>';
	var cache = {};
	$( "#reassign_user_new" ).autocomplete({
		minLength: 2,
		source: function( request, response ) {
			var term = request.term;
			console.log( term );
			console.log( cache );
			if ( term in cache ) {
				response( cache[ term ] );
			console.log( user_endpoint + '?search=' + term );
			$.getJSON( user_endpoint + '?search=' + term, request, function( data, status, xhr ) {
				cache[ term ] = data;
				response( data );

What's your thoughts on this? I can definitely see some possible implementations around the admin, like the privacy page dropdown, what if you have thousands of pages?

Any thoughts @spacedmonkey ?

Last edited 4 years ago by Mista-Flo (previous) (diff)

#10 @bedas
2 months ago

  • Resolution set to duplicate
  • Status changed from reopened to closed

Duplicate of #19867.

This is a duplicate of 19867?

Note: See TracTickets for help on using tickets.