ACF_Location_Page::get_values
Returns an array of possible values for this rule type.
Method of the class: ACF_Location_Page{}
No Hooks.
Returns
Array.
Usage
$ACF_Location_Page = new ACF_Location_Page(); $ACF_Location_Page->get_values( $rule );
- $rule(array) (required)
- A location rule.
Changelog
| Since 5.9.0 | Introduced. |
ACF_Location_Page::get_values() ACF Location Page::get values code ACF 6.8.8
public function get_values( $rule ) {
$choices = array();
// Get grouped posts.
$groups = acf_get_grouped_posts(
array(
'post_type' => array( 'page' ),
)
);
// Get first group.
$posts = reset( $groups );
// Append to choices.
if ( $posts ) {
foreach ( $posts as $post ) {
$choices[ $post->ID ] = acf_get_post_title( $post );
}
}
return $choices;
}