WP_Embed::delete_oembed_caches() WordPress Method

The WP_Embed::delete_oembed_caches() function is used to delete all cached oEmbed response data. This function is useful when oEmbed providers change their oEmbed response data format, or when switching between oEmbed providers.

WP_Embed::delete_oembed_caches( int $post_ID ) #

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


Parameters

$post_ID

(int)(Required)Post ID to delete the caches for.


Top ↑

Source

File: wp-includes/class-wp-embed.php

	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 ( '_oembed_' === substr( $post_meta_key, 0, 8 ) ) {
				delete_post_meta( $post_ID, $post_meta_key );
			}
		}
	}

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.