Screenshot indicating this user has several hundred sites associated with their account.

So Many Sites – Cleaning Up Users

There are lots of ways users can end up associated with many sites in a WordPress multisite install. That’s no big deal if it’s only five or ten but sometimes it’s way more. It’s not just messy, it actually degrades performance when you’re logged in because the admin menu bar loads all those sites. This can really become a drag as you pass a hundred or so sites. Previously, I’ve just given up on the user and made a new one. I’ve also gone through and opened up a number of sites and removed the user from each one manually. That’s a pretty awful pattern but being in a hurry leads to all sorts of bad choices.1 Today I got the request to remove around six hundred sites from a particular faculty member. The request coincided with time and mental bandwidth so I opted to do this in an intelligent way. There was also no way I was going to do this by hand. First step would be to get the user’s id from the wp_users table. You can look up users here by user_login or user_email and get to what you need pretty quickly. If you’re using Sequel Pro rather than the terminal don’t forget to restrain your searches by the right field. For this example, we’ll pretend […]