How to get user avatar via WPDB

For my REST-API i need to get for every post the username, date … and Avatar !

$query =”SELECT POST.ID, POST.post_title, POST.post_date,
USER.user_nicename FROM
wp0x_posts POST INNER JOIN wp0x_users USER
ON USER.ID=POST.post_author and POST.post_type=’post’ “;

The probleme that i have faced is that the avatars are stored in wp_posts
, so i don’t know how to call it for posts titles and call it again for users avatars

it would be much easier if the avatars were stored in wp_users :/

is there a way to get all these values in one query

POST ID
POST TITLE
POST DATE
AUTHOR
AVATAR

Read more here:: How to get user avatar via WPDB

Leave a Reply

Your email address will not be published. Required fields are marked *