Make WordPress Core

Opened 3 years ago

Closed 3 years ago

#22190 closed defect (bug) (fixed)

Delete oEmbed caches on pre_post_update so cached meta is used

Reported by: nacin Owned by: nacin
Milestone: 3.5 Priority: normal
Severity: normal Version:
Component: Performance Keywords: has-patch
Focuses: Cc:


WP_Embed::delete_oembed_caches() is hooked into 'save_post', after which it calls get_post_meta() in a roundabout way. This results in an automatic update_meta_cache() call for a saved post, when it may not be otherwise needed for the rest of that pageload.

By moving oEmbed deletion to pre_post_update, we're able to use metadata that is more likely to already be in cache. If it is not already in cache but we do need metadata after, this could potentially add a query. But, I think the tradeoff is worth it.

Parent ticket: #22189. Saving navigation menus are slow.

Attachments (1)

22190.diff (1.3 KB) - added by nacin 3 years ago.

Download all attachments as: .zip

Change History (2)

@nacin3 years ago

comment:1 @nacin3 years ago

  • Owner set to nacin
  • Resolution set to fixed
  • Status changed from new to closed

In 22369:

Invalidate oEmbed caches on pre_post_update instead of save_post so existing metadata caches may be used. fixes #22190.

Note: See TracTickets for help on using tickets.