ACF_Location_Post_Status::match
Matches the provided rule against the screen args returning a bool result.
Method of the class: ACF_Location_Post_Status{}
No Hooks.
Returns
true|false.
Usage
$ACF_Location_Post_Status = new ACF_Location_Post_Status(); $ACF_Location_Post_Status->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_Status::match() ACF Location Post Status::match code 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 );
}