Custom queries and post_meta
-
Hi all.
I have a very large database of a custom post types (1,100+ posts) and each post has a a single post_meta attached to the post_id with an array of all custom values (to minimize database entries and number of post_meta attached, I assume).
We need to construct a custom query that pull all 1,100 posts along with their post_meta to create a custom list for a single page on the website. This result data would be stored in a array which we would use for a custom search algorithm, statistics, etc. Quite a few pages have output that is conditional on what a value in the post_meta returned array contains. I am aware that WP has an ability to cache post_meta but I am not sure exactly how it works. Any suggestions or insight would be greatly appreciated.
My question is…
What would be the best way to pull this data to use in the application:
1. a custom wp_query using a get_post_meta() function call for each post
2. WP_Query using the meta_query (not sure if you can check for associative array values).
3. a custom SQL query straight to the database
4. something better 🙂Thank you all for your help!
- The topic ‘Custom queries and post_meta’ is closed to new replies.