ACF_Location_Post::get_values()
Returns an array of possible values for this rule type.
Метод класса: ACF_Location_Post{}
Хуков нет.
Возвращает
Массив
.
Использование
$ACF_Location_Post = new ACF_Location_Post(); $ACF_Location_Post->get_values( $rule );
- $rule(массив) (обязательный)
- A location rule.
Список изменений
С версии 5.9.0 | Введена. |
Код ACF_Location_Post::get_values() ACF Location Post::get values ACF 6.0.4
public function get_values( $rule ) { $choices = array(); // Get post types. $post_types = acf_get_post_types( array( 'show_ui' => 1, 'exclude' => array( 'page', 'attachment' ), ) ); // Get grouped posts. $groups = acf_get_grouped_posts( array( 'post_type' => $post_types, ) ); // Append to choices. if ( $groups ) { foreach ( $groups as $label => $posts ) { $choices[ $label ] = array(); foreach ( $posts as $post ) { $choices[ $label ][ $post->ID ] = acf_get_post_title( $post ); } } } return $choices; }