Home › Forums › General Issues › Get a field object outside of the post context › Reply To: Get a field object outside of the post context
The problem is mainly that what you’re looking for is all the custom field values for a specific custom field for all the posts on the site. This is problematic using any of the standard WP functions. There is nothing in WP that will return this information without using wpdb
directly.
My solution is pretty quick and a bit dirty, but should work in most cases and be safe to use. For example, I’m not using a JOIN on the posts table, so my query will return values set for any type of post, including drafts and trash or whatever but 99% of the time that should not matter, unless you’ve recently trashed all of the posts of a language or just started creating drafts of a new language. I’m not really an expert on wpdb
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.