Yoast\WP\SEO\Builders

Indexable_Author_Builder::find_alternative_image()protectedYoast 1.0

Finds an alternative image for the social image.

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

Хуков нет.

Возвращает

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

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

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

Код Indexable_Author_Builder::find_alternative_image() Yoast 22.4

protected function find_alternative_image( Indexable $indexable ) {
	$gravatar_image = \get_avatar_url(
		$indexable->object_id,
		[
			'size'   => 500,
			'scheme' => 'https',
		]
	);
	if ( $gravatar_image ) {
		return [
			'image'  => $gravatar_image,
			'source' => 'gravatar-image',
		];
	}

	return false;
}