[wp-trac] [WordPress Trac] #22189: Saving navigation menus is slow

WordPress Trac wp-trac at lists.automattic.com
Mon Oct 15 04:08:24 UTC 2012


#22189: Saving navigation menus is slow
--------------------------+------------------
 Reporter:  nacin         |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  3.5
Component:  Menus         |     Version:
 Severity:  normal        |  Resolution:
 Keywords:                |
--------------------------+------------------

Comment (by nacin):

 [attachment:22189.diff] — Avoid useless queries in wp_unique_post_slug()
 for nav menu items. We may want to introduce a pre_* filter here in the
 future, so plugins could similarly sidestep these queries.

 [attachment:22189.2.diff] — When printing nav checklists, we avoid meta
 and term caches. WP_Post's magic get/set will trigger a metadata_exists()
 check. Using property_exists() and some cleaner code can prevent the meta
 cache from firing.

 #22190 — Delete oEmbed caches on pre_post_update so cached meta is used.
 Patch: [attachment:22190.diff:ticket:22190 attachment:22190.diff].

 #22191 — In update_metadata(), compare old/new values before deciding
 whether to call add_metadata(). Patch [attachment:22191.diff:ticket:22191
 attachment:22191.diff].

 #22192 — update_metadata() and update_option() strict checks can cause
 false negatives. No patch, but this is solved for nav menus only in
 [attachment:22189.3.diff] by casting integers to strings.

 Also in [attachment:22189.3.diff]:

  * Don't call wp_get_nav_menu_items() in wp_update_nav_menu_item() unless
 we need to. (Huge.)

  * When saving a menu item, only set the menu term against it if it isn't
 already set. This prevents a wp_get_object_terms() call that can trigger a
 meta cache we haven't loaded.

  * When creating a new menu item, we need to create it then add meta (as
 we need the post ID to do so). But when updating a menu item, update the
 meta first. This allows for update_metadata() to use the existing meta
 cache for old/new comparison, rather than forcing a new meta cache fetch.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/22189#comment:3>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list