Export a list of WordPress users from MySQL

Last Updated: April 9, 2019

Need to pull an export of your users from WordPress, but don’t want to fiddle around with test-driving a dozen plugins?

You can also select users belonging to a specific role.

SELECT
	u.ID,
	u.user_email,
	umf.meta_value AS first_name,
	uml.meta_value AS last_name,
	umc.meta_value AS capabilities
FROM wp_users u
LEFT JOIN wp_usermeta AS umf ON u.ID = umf.user_id AND umf.meta_key = 'first_name'
LEFT JOIN wp_usermeta AS uml ON u.ID = uml.user_id AND uml.meta_key = 'last_name'
LEFT JOIN wp_usermeta AS umc ON u.ID = umc.user_id AND umc.meta_key = 'wp_capabilities'
WHERE
	u.ID = umf.user_id AND
	u.ID = uml.user_id AND
	u.ID = umc.user_id AND
	umc.meta_value LIKE '%administrator%'
Posted in ,

Chris Aram

I'm a developer who specializes in whipping your technology into shape so that it makes your professional and personal life better.