Yoast\WP\SEO\Builders

Indexable_Term_Builder::find_alternative_image()protectedYoast 1.0

Finds an alternative image for the social image.

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

Хуков нет.

Возвращает

Массив|true|false. False when not found, array with data when found.

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

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->find_alternative_image( $indexable );
$indexable(Indexable) (обязательный)
The indexable.

Код Indexable_Term_Builder::find_alternative_image() Yoast 22.4

protected function find_alternative_image( Indexable $indexable ) {
	$content_image = $this->image->get_term_content_image( $indexable->object_id );
	if ( $content_image ) {
		return [
			'image'  => $content_image,
			'source' => 'first-content-image',
		];
	}

	return false;
}