public function clear( $args, $assoc_args ) {
		/** @var \WP_Embed $wp_embed */
		global $wp_embed;

		$post_id = $args[0];

		$post_metas = get_post_custom_keys( $post_id );

		if ( $post_metas ) {
			$post_metas = array_filter(
				$post_metas,
				function ( $v ) {
					return '_oembed_' === substr( $v, 0, 8 );
				}
			);
		}

		if ( empty( $post_metas ) ) {
			WP_CLI::error( 'No cache to clear!' );
		}

		$wp_embed->delete_oembed_caches( $post_id );

		WP_CLI::success( 'Cleared oEmbed cache.' );
	}
public function clear( $args, $assoc_args ) {
		/** @var \WP_Embed $wp_embed */
		global $wp_embed;

		$post_id = $args[0];

		$post_metas = get_post_custom_keys( $post_id );

		if ( $post_metas ) {
			$post_metas = array_filter(
				$post_metas,
				function ( $v ) {
					return '_oembed_' === substr( $v, 0, 8 );
				}
			);
		}

		if ( empty( $post_metas ) ) {
			WP_CLI::error( 'No cache to clear!' );
		}

		$wp_embed->delete_oembed_caches( $post_id );

		WP_CLI::success( 'Cleared oEmbed cache.' );
	}
public function clear ( $ args , $ assoc_args ) { /** @var \WP_Embed $wp_embed */ global $ wp_embed ; $ post_id = $ args [ 0 ] ; $ post_metas = get_post_custom_keys ( $ post_id ) ; if ( $ post_metas ) { $ post_metas = array_filter ( $ post_metas , function ( $ v ) { return '_oembed_' === substr ( $ v , 0 , 8 ) ; } ) ; } if ( empty ( $ post_metas ) ) { WP_CLI :: error ( 'No cache to clear!' ) ; } $ wp_embed -> delete_oembed_caches ( $ post_id ) ; WP_CLI :: success ( 'Cleared oEmbed cache.' ) ; }
Deletes all oEmbed caches for a given post.

oEmbed caches for a post are stored in the post's metadata.

## OPTIONS

<post_id>
: ID of the post to clear the cache for.

## EXAMPLES

# Clear cache for a post
$ wp embed cache clear 123
Success: Cleared oEmbed cache.
Deletes all oEmbed caches for a given post .