WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
функция не описана

WP_Embed::find_oembed_post_id() public WP 4.9.0

Find the oEmbed cache post ID for a given cache key.

Это метод класса: WP_Embed{}

Хуков нет.

Возвращает

Число/null. Post ID on success, null on failure.

Использование

$WP_Embed = new WP_Embed();
$WP_Embed->find_oembed_post_id( $cache_key );
$cache_key(строка) (обязательный)
oEmbed cache key.

Список изменений

С версии 4.9.0 Введена.

Код WP_Embed::find_oembed_post_id() WP 5.5.1

wp-includes/class-wp-embed.php
<?php
public function find_oembed_post_id( $cache_key ) {
	$cache_group    = 'oembed_cache_post';
	$oembed_post_id = wp_cache_get( $cache_key, $cache_group );

	if ( $oembed_post_id && 'oembed_cache' === get_post_type( $oembed_post_id ) ) {
		return $oembed_post_id;
	}

	$oembed_post_query = new WP_Query(
		array(
			'post_type'              => 'oembed_cache',
			'post_status'            => 'publish',
			'name'                   => $cache_key,
			'posts_per_page'         => 1,
			'no_found_rows'          => true,
			'cache_results'          => true,
			'update_post_meta_cache' => false,
			'update_post_term_cache' => false,
			'lazy_load_term_meta'    => false,
		)
	);

	if ( ! empty( $oembed_post_query->posts ) ) {
		// Note: 'fields' => 'ids' is not being used in order to cache the post object as it will be needed.
		$oembed_post_id = $oembed_post_query->posts[0]->ID;
		wp_cache_set( $cache_key, $oembed_post_id, $cache_group );

		return $oembed_post_id;
	}

	return null;
}