acf_get_location_rule_types()
Returns a grouped array of all location rule types.
Хуки из функции
Возвращает
Массив.
Использование
acf_get_location_rule_types();
Список изменений
| С версии 5.9.0 | Введена. |
Код acf_get_location_rule_types() acf get location rule types ACF 6.4.2
function acf_get_location_rule_types() {
$types = array();
// Default categories.
$categories = array(
'post' => __( 'Post', 'acf' ),
'page' => __( 'Page', 'acf' ),
'user' => __( 'User', 'acf' ),
'forms' => __( 'Forms', 'acf' ),
);
// Loop over all location types and append to $type.
$location_types = acf_get_location_types();
foreach ( $location_types as $location_type ) {
// Ignore if not public.
if ( ! $location_type->public ) {
continue;
}
// Find category label from category name.
$category = $location_type->category;
if ( isset( $categories[ $category ] ) ) {
$category = $categories[ $category ];
}
// Append
$types[ $category ][ $location_type->name ] = esc_html( $location_type->label );
}
/**
* Filters the location rule types.
*
* @date 8/4/20
* @since 5.9.0
*
* @param array $types The location rule types.
*/
return apply_filters( 'acf/location/rule_types', $types );
}