mardi 7 juin 2016

Get wordpress users ordered by the date of their latest post (CPT)

Need to get the last 5 users that posted in a certain custom post type. Since I seem not to be able to find a WordPress function to do so, I am trying to write a custom query. So far I have gotten this in order to get the last five and their number of posts (for the my_custom_type only) but it is not working yet:

SELECT *, count(ID) FROM wp_posts WHERE post_type = 'my_custom_type' GROUP BY post_author ORDER BY post_author DESC LIMIT 5

I would like to skip the admin (userid=1). Please help!



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire