Requêtes SQL WordPress – WordPress SQL requests

Requête SQL permettant de faire un export des utilisateurs WordPress avec leur meta-données – SQL request to perform WordPress users export with metadata :

SELECT
user.ID,
user.user_email,
user.user_registered,
(SELECT meta.meta_value FROM wp_usermeta AS meta WHERE meta.user_id = user.ID AND meta.meta_key LIKE 'first_name'),
(SELECT meta.meta_value FROM wp_usermeta AS meta WHERE meta.user_id = user.ID AND meta.meta_key LIKE 'last_name')
INNER JOIN wp_usermeta AS usermeta ON usermeta.user_id = user.ID
FROM wp_users AS user

Requête SQL permettant de faire un export des abonnés WordPress avec leur meta-données – SQL request to perform WordPress subscribers export with metadata :

SELECT
user.ID,
user.user_email,
user.user_registered,
(SELECT meta.meta_value FROM wp_usermeta AS meta WHERE meta.user_id = user.ID AND meta.meta_key LIKE 'first_name'),
(SELECT meta.meta_value FROM wp_usermeta AS meta WHERE meta.user_id = user.ID AND meta.meta_key LIKE 'last_name')
INNER JOIN wp_usermeta AS usermeta ON usermeta.user_id = user.ID
FROM wp_users AS user
WHERE usermeta.meta_key = 'wpout_capabilities'
AND usermeta.meta_value LIKE '%subscriber%'