[wp-trac] [WordPress Trac] #14759: Improve the way oEmbed deals with caching

WordPress Trac noreply at wordpress.org
Mon Nov 24 23:44:24 UTC 2014


#14759: Improve the way oEmbed deals with caching
-----------------------------------------+---------------------
 Reporter:  Viper007Bond                 |       Owner:  helen
     Type:  enhancement                  |      Status:  closed
 Priority:  normal                       |   Milestone:  4.0
Component:  Embeds                       |     Version:  3.0.1
 Severity:  normal                       |  Resolution:  fixed
 Keywords:  has-patch commit needs-docs  |     Focuses:
-----------------------------------------+---------------------
Changes (by kevinweber):

 * keywords:  has-patch commit => has-patch commit needs-docs


Comment:

 Hi Helen,

 you annotated that the delete_oembed_caches() function is "Unused by core
 as of 4.0.0."

 I tried to implement an alternative method to clear caches/ttl for one of
 my plugins (Lazy Load for Videos) – but nothing seems to work. I tried it
 for several hours :-/
 What's the best method to clear all oembed caches?

 For now, I use the following code:

 {{{
         function delete_oembed_caches() {
                 global $wp_embed;
                 $lazyload_videos_general = new Lazyload_Videos_General();

             $post_ids = get_posts(
                 array(
                         'post_type' =>
 $lazyload_videos_general->get_post_types(),
                         'posts_per_page' => -1, // -1 == no limit
                         'fields' => 'ids',      // Just retrieve a list of
 IDs (http://thomasgriffinmedia.com/blog/2012/10/optimize-wordpress-
 queries/)
                         ) );

             foreach ( $post_ids as $post_id ):
                 $wp_embed->delete_oembed_caches( $post_id );
             endforeach;
         }
 }}}

 Would be amazing if you could give me at least a hint.

 Best regards,
 Kevin

 Replying to [comment:53 helen]:
 > In [changeset:"28972"]:
 > {{{
 > #!CommitTicketReference repository="" revision="28972"
 > Improve oEmbed caching. Introduces the concept of a TTL for oEmbed
 caches and a filter for `oembed_ttl`.

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


More information about the wp-trac mailing list