Yoast\WP\SEO\Helpers

Image_Helper::get_featured_image_id()publicYoast 1.0

Retrieves the ID of the featured image.

Метод класса: Image_Helper{}

Хуков нет.

Возвращает

int|true|false. ID when found, false when not.

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

$Image_Helper = new Image_Helper();
$Image_Helper->get_featured_image_id( $post_id );
$post_id(int) (обязательный)
The post id to get featured image id for.

Код Image_Helper::get_featured_image_id() Yoast 22.4

public function get_featured_image_id( $post_id ) {
	if ( ! \has_post_thumbnail( $post_id ) ) {
		return false;
	}

	return \get_post_thumbnail_id( $post_id );
}