ACF_Location_Page_Template::match
Matches the provided rule against the screen args returning a bool result.
Метод класса: ACF_Location_Page_Template{}
Хуков нет.
Возвращает
true|false.
Использование
$ACF_Location_Page_Template = new ACF_Location_Page_Template(); $ACF_Location_Page_Template->match( $rule, $screen, $field_group );
- $rule(массив) (обязательный)
- The location rule.
- $screen(массив) (обязательный)
- The screen args.
- $field_group(массив) (обязательный)
- The field group settings.
Список изменений
| С версии 5.9.0 | Введена. |
Код ACF_Location_Page_Template::match() ACF Location Page Template::match ACF 6.4.2
public function match( $rule, $screen, $field_group ) {
// Check screen args.
if ( isset( $screen['post_type'] ) ) {
$post_type = $screen['post_type'];
} elseif ( isset( $screen['post_id'] ) ) {
$post_type = get_post_type( $screen['post_id'] );
} else {
return false;
}
// Page templates were extended in WordPress version 4.7 for all post types.
// Prevent this rule (which is scoped to the "page" post type) appearing on all post types without a template selected (default template).
if ( $rule['value'] === 'default' && $post_type !== 'page' ) {
return false;
}
// Match rule using Post Template logic.
return acf_get_location_type( 'post_template' )->match( $rule, $screen, $field_group );
}