Open Mte90 opened 1 month ago
The new query should be:
SELECT wp_users.ID
FROM wp_users
INNER JOIN wp_usermeta
ON ( wp_users.ID = wp_usermeta.user_id )
LEFT OUTER JOIN (
SELECT ID, post_author, COUNT(*) as post_count
FROM wp_posts
WHERE ( ( post_type = 'post'
AND ( post_status = 'publish'
OR post_status = 'private' ) ) )
GROUP BY post_author ) p
ON (wp_users.ID = p.post_author)
LEFT JOIN wp_term_relationships
ON (p.ID = wp_term_relationships.object_id)
WHERE 1=1
AND ( wp_term_relationships.term_taxonomy_id IN (10017) )
AND ( ( ( wp_usermeta.meta_key = 'wp_capabilities'
AND wp_usermeta.meta_value LIKE '%\"contributor\"%' ) ) )
ORDER BY post_count DESC
LIMIT 0, 3
Prerequisites
master
branch of Polylang and the latest WordPress version.Steps to reproduce the issue
Generate this query:
As you can see the WP_User_Query doesn't check for the language (I tried too with the lang parameter).
Expected behavior and actual behavior
I was expecting a way to order users based the amount of articles they published in a language.