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