Skip to content

Instantly share code, notes, and snippets.

@JulioPotier
Created November 9, 2015 13:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JulioPotier/e03703d3f4d2e6d1ab6d to your computer and use it in GitHub Desktop.
Save JulioPotier/e03703d3f4d2e6d1ab6d to your computer and use it in GitHub Desktop.
<?php
/**
* Plugin Name: Empty Embeds cache
* Description: You already read it
* Version: 1.0
* Author: Julio Potier
* Author URI: https://wp-rocket.me
* License: GPLv2+
*
*/
add_action( 'plugins_loaded', 'empty_embed_cache' );
function empty_embed_cache() {
global $wpdb;
$wpdb->query( 'DELETE from ' . $wpdb->postmeta . ' WHERE meta_key LIKE "_oembed_%"' );
wp_die( 'Cache emptied, please now remove this file : <b>' . __FILE__ . '</b>' );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment