Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
WordPress Clear oEmbed Cache Automatically on Post Save
add_action( 'save_post', function( $post_id ) {
if( get_post_type( $post_id ) != WPEP_POST_TYPE_COURSE )
global $wpdb;
$wpdb->query( 'DELETE FROM `' . $wpdb->postmeta . '` WHERE `meta_key` LIKE "_oembed%" AND post_id = ' . $post_id );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.