Pre-cache post_meta for nav_menu_items rather than querying one at a time
|Reported by:||mitchoyoshitaka||Owned by:|
We know that wp_get_nav_menu_items is going to have to get_post_meta on each individual nav menu item, and unless it's already cached, each of these get_post_meta will spawn their own database query to update_meta_cache.
Instead, we could update_meta_cache once on all of the objects which we know we're going to hit at the beginning of wp_get_nav_menu_items.
Here's the effect of this patch on DB queries on a site I'm working on, with two decently sized nav menus: (averaged over 10 hits)
3.3-trunk: 69 ms, 198 queries
with patch: 55 ms, 142 queries