WP_Embed::delete_oembed_caches( int $post_id )

In this article

Deletes all oEmbed caches. Unused by core as of 4.0.0.

Parameters

$post_idintrequired
Post ID to delete the caches for.

Source

public function delete_oembed_caches( $post_id ) {
	$post_metas = get_post_custom_keys( $post_id );
	if ( empty( $post_metas ) ) {
		return;
	}

	foreach ( $post_metas as $post_meta_key ) {
		if ( str_starts_with( $post_meta_key, '_oembed_' ) ) {
			delete_post_meta( $post_id, $post_meta_key );
		}
	}
}

User Contributed Notes

You must log in before being able to contribute a note or feedback.