Home › Forums › General Issues › Bulk Fetch ACF field across multiple posts › Reply To: Bulk Fetch ACF field across multiple posts
There isn’t any way to do this using WP_Query() or get_posts().
To to this your would need to query the DB directly using $wpdb
A quick example of a basic query to get meta from published posts. This is not perfect, just an example of what needs doing
SELECT wp_posts.ID, wp_postmeta.meta_value
FROM wp_posts, wp_postmeta
WHERE wp_posts.post_status = "publish" AND
wp_posts.ID = wp_post_meta.post_id AND
wp_postmeta.meta_key = "location"
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.