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.