WP_Embed::cache_oembed

Advertisement

Summery Summery

Triggers a caching of all oEmbed results.

Syntax Syntax

WP_Embed::cache_oembed( int $post_ID )

Parameters Parameters

$post_ID

(Required) Post ID to do the caching for.

Source Source

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

			/** This filter is documented in wp-includes/class-wp-embed.php */
			return apply_filters( 'embed_oembed_html', $html, $url, $attr, $post_ID );
		}

		// Still unknown.
		return $this->maybe_make_link( $url );
	}

	/**
	 * Delete all oEmbed caches. Unused by core as of 4.0.0.
	 *
	 * @param int $post_ID Post ID to delete the caches for.
	 */
	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 );
			}
		}
	}

Advertisement

Advertisement

Leave a Reply