Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
<?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