Hi,
I’ve an ap getting datas in my WP mysql database.
I’m looking for an SQL query to get all posts of ‘books’ custom post type. And this query have to return all posts with all acf metas.
A sql like this ‘SELECT * FROM posts WHERE post_type = ‘events’
I’m newbie with SQL queries… can you help me ?
There isn’t a query that you can run that will select posts and return all meta values associated with it. This requires multiple queries. First the one you have above. Then you need to loop over that return and do a query like:
// please note that this may not be the best way to do this query,
// I am not an SQL expert.
"SELECT * FROM postmeta WHERE post_id = '{$post_id}'