ACF_Location_Post_Format::matchpublicACF 5.9.0

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

Method of the class: ACF_Location_Post_Format{}

No Hooks.

Returns

true|false.

Usage

$ACF_Location_Post_Format = new ACF_Location_Post_Format();
$ACF_Location_Post_Format->match( $rule, $screen, $field_group );
$rule(array) (required)
The location rule.
$screen(array) (required)
The screen args.
$field_group(array) (required)
The field group settings.

Changelog

Since 5.9.0 Introduced.

ACF_Location_Post_Format::match() code ACF 6.8.8

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 );
}