acf_field_post_object::get_posts
get_posts
This function will return an array of posts for a given field value
Method of the class: acf_field_post_object{}
No Hooks.
Returns
$value.
Usage
$acf_field_post_object = new acf_field_post_object(); $acf_field_post_object->get_posts( $value, $field );
- $value(required)
- .
- $field(required)
- .
Changelog
| Since 5.0.0 | Introduced. |
acf_field_post_object::get_posts() acf field post object::get posts code ACF 6.0.4
function get_posts( $value, $field ) {
// numeric
$value = acf_get_numeric( $value );
// bail early if no value
if ( empty( $value ) ) {
return false;
}
// get posts
$posts = acf_get_posts(
array(
'post__in' => $value,
'post_type' => $field['post_type'],
)
);
// return
return $posts;
}