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

Yoast\WP\SEO\Helpers

Image_Helper::get_best_attachment_variation() public Yoast 1.0

Retrieves the best attachment variation for the given attachment.

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

Хуков нет.

Возвращает

true/false/Строку. The attachment url or false when no variations found.

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

$Image_Helper = new Image_Helper();
$Image_Helper->get_best_attachment_variation( $attachment_id );
$attachment_id(число) (обязательный)
The attachment id.

Код Image_Helper::get_best_attachment_variation() Yoast 15.6.2

<?php
public function get_best_attachment_variation( $attachment_id ) {
	$variations = WPSEO_Image_Utils::get_variations( $attachment_id );
	$variations = WPSEO_Image_Utils::filter_usable_file_size( $variations );

	// If we are left without variations, there is no valid variation for this attachment.
	if ( empty( $variations ) ) {
		return false;
	}

	// The variations are ordered so the first variations is by definition the best one.
	return \reset( $variations );
}