Requêtes SQL WordPress – WordPress SQL requests

Requête permettant de faire un export des utilisateur WordPress avec leur meta-données – Request to perform 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 permettant de faire un export des abonnés WordPress avec leur meta-données – Request to perform 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%'