ACF_Location_Post_Status::match()publicACF 5.9.0

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

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

Хуков нет.

Возвращает

true|false.

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

$ACF_Location_Post_Status = new ACF_Location_Post_Status();
$ACF_Location_Post_Status->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_Status::match() ACF 6.0.4

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

	// Check screen args.
	if ( isset( $screen['post_status'] ) ) {
		$post_status = $screen['post_status'];
	} elseif ( isset( $screen['post_id'] ) ) {
		$post_status = get_post_status( $screen['post_id'] );
	} else {
		return false;
	}

	 // Treat "auto-draft" as "draft".
	if ( $post_status === 'auto-draft' ) {
		$post_status = 'draft';
	}

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