ACF_Location_Page_Parent::match
Matches the provided rule against the screen args returning a bool result.
Method of the class: ACF_Location_Page_Parent{}
No Hooks.
Returns
true|false.
Usage
$ACF_Location_Page_Parent = new ACF_Location_Page_Parent(); $ACF_Location_Page_Parent->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_Page_Parent::match() ACF Location Page Parent::match code ACF 6.8.8
public function match( $rule, $screen, $field_group ) {
// Check screen args.
if ( isset( $screen['page_parent'] ) ) {
$page_parent = $screen['page_parent'];
} elseif ( isset( $screen['post_id'] ) ) {
$post = get_post( $screen['post_id'] );
$page_parent = $post ? $post->post_parent : false;
} else {
return false;
}
// Compare rule against $page_parent.
return $this->compare_to_rule( $page_parent, $rule );
}