[wp-trac] [WordPress Trac] #63667: Delete oEmbed postmeta if the related embed block is deleted / no longer present in the content

WordPress Trac noreply at wordpress.org
Wed Jul 9 20:28:19 UTC 2025


#63667: Delete oEmbed postmeta if the related embed block is deleted / no longer
present in the content
-------------------------------------------------+-------------------------
 Reporter:  oglekler                             |       Owner:  (none)
     Type:  defect (bug)                         |      Status:  new
 Priority:  normal                               |   Milestone:  Awaiting
                                                 |  Review
Component:  Embeds                               |     Version:  2.9
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch has-unit-tests has-test-   |     Focuses:
  info dev-feedback                              |
-------------------------------------------------+-------------------------
Changes (by SirLouen):

 * keywords:  has-patch has-unit-tests => has-patch has-unit-tests has-test-
     info dev-feedback
 * version:   => 2.9


Comment:

 == Testing Information

 1. Create a new Post
 2. Add any Oembed, for example a YouTube video. You can add 2 if you want
 to play around
 3. Save the post
 4. Go to the database, table `wp_postmeta` and check for the last
 `meta_key` created that should be like `_oembed_<long_md5_id>` for
 example: `_oembed_9b8701b5644e2d4823a2beee2049cd0e`
 5. Now open that new post again
 6. Remove the oembed and save again
 7. Before the patch, the previous `_oembed_` key should be there. After
 the past, it should be gone.
 8. For extra testing, if you added two oembeds, the second one that you
 did not delete should still be there.

 === Additional Information

 - I have done a little refactoring. After some extra review, I can't
 really see why in [12023] it was chosen to hook to `maybe_run_ajax_cache`
 instead of directly to `cache_oembed`. It's a way longer route without any
 clear advantage (given that the whole code is already being executed PHP
 level), but it can bring some troubles.

 Needs further review.

 cc @peterwilsoncc

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/63667#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list