WPSEO_Image_Utils::filter_usable_dimensions()public staticYoast 1.0

Check original size of image. If original image is too small, return false, else return true.

Filters a list of variations by a certain set of usable dimensions.

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

Хуков нет.


Массив. Whether a variation is fit for display or not.


$result = WPSEO_Image_Utils::filter_usable_dimensions( $usable_dimensions, $variations );
$usable_dimensions(массив) (обязательный)

The parameters to check against.

  • min_width(int)
    Minimum width of image.

  • max_width(int)
    Maximum width of image.

  • min_height(int)
    Minimum height of image.

  • max_height(int)
    Maximum height of image.
$variations(массив) (обязательный)
The variations that should be considered.

Код WPSEO_Image_Utils::filter_usable_dimensions() Yoast 19.7.1

public static function filter_usable_dimensions( $usable_dimensions, $variations ) {
	$filtered = [];

	foreach ( $variations as $variation ) {
		$dimensions = $variation;

		if ( self::has_usable_dimensions( $dimensions, $usable_dimensions ) ) {
			$filtered[] = $variation;

	return $filtered;