Tell me more ×
WordPress Answers is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am building a web app with WordPress. I have a situation where every time I do a while ($query->have_posts()), I immediately do a get_field('due_date'). I'm using advanced custom fields. This particular field is nothing more than a post meta entry for that post, so it's not necessarily plugin dependent.

Instead of doing that additional query (and it does add a mysql query) every time, can I preload that with new WP_Query()? Better yet, can I retrieve all metadata for a particular post with WP_Query? My number of queries is quickly spiraling out of control.

Additionally, can I hook extra functions in addition to get_the_ID(), etc? So could I set up a function and pass it to WP_Query somehow to use get_due_date() instead of get_field('due_date') ?

Thanks.

share|improve this question

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.