How to search for user last name in the WordPress Users dashboard

Have a client with almost 2500 users in their WordPress site and they wanted to be able to search their users by last name. By default this is not enabled in WordPress core, so here is a quick function/hook you can add to your functions.php file to enable this:

I will probably expand this a little and create a WordPress plugin for it (if I can find the time).

NOTE: The trim regex should be this – ‘* \t\n\r\0\x0B’ – but the plugin I’m using is stripping the \r

Similar Posts