[wp-trac] [WordPress Trac] #34368: WP_Site_Icon->get_post_metadata performance improvement
WordPress Trac
noreply at wordpress.org
Tue Oct 20 10:16:22 UTC 2015
#34368: WP_Site_Icon->get_post_metadata performance improvement
----------------------------+-----------------------------
Reporter: ap.koponen | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Administration | Version: trunk
Severity: normal | Keywords:
Focuses: performance |
----------------------------+-----------------------------
Hi,
while trying to improve the performance of a plugin that used a lot of
get_post_meta (WooCommerce Bookings) I noticed from my Cache Grind
analysis that WP_Site_Icon->get_post_metadata was calling get_option a lot
(11 336 times in my case).
I noticed that this call was unnecessary, if $single and $meta_key did not
match so I refactored the function to call get_option only if it was
necessary. This refactoring reduced the get_option calls to 0.
Ari-Pekka Koponen
--
Ticket URL: <https://core.trac.wordpress.org/ticket/34368>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list