ACF_Location_Post_Format::match()publicACF 5.9.0

Matches the provided rule against the screen args returning a bool result.

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

Хуков нет.

Возвращает

true|false.

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

$ACF_Location_Post_Format = new ACF_Location_Post_Format();
$ACF_Location_Post_Format->match( $rule, $screen, $field_group );
$rule(массив) (обязательный)
The location rule.
$screen(массив) (обязательный)
The screen args.
$field_group(массив) (обязательный)
The field group settings.

Список изменений

С версии 5.9.0 Введена.

Код ACF_Location_Post_Format::match() ACF 6.0.4

public function match( $rule, $screen, $field_group ) {

	// Check screen args.
	if ( isset( $screen['post_format'] ) ) {
		$post_format = $screen['post_format'];
	} elseif ( isset( $screen['post_id'] ) ) {
		$post_type   = get_post_type( $screen['post_id'] );
		$post_format = get_post_format( $screen['post_id'] );

		// Treat new posts (that support post-formats) without a saved format as "standard".
		if ( ! $post_format && post_type_supports( $post_type, 'post-formats' ) ) {
			$post_format = 'standard';
		}
	} else {
		return false;
	}

	// Compare rule against $post_format.
	return $this->compare_to_rule( $post_format, $rule );
}