acf_field_post_object::get_posts
This function will return an array of posts for a given field value
Метод класса: acf_field_post_object{}
Хуков нет.
Возвращает
Массив. $value An array of post objects.
Использование
$acf_field_post_object = new acf_field_post_object(); $acf_field_post_object->get_posts( $value, $field );
- $value(разное) (обязательный)
- The value of the field.
- $field(массив) (обязательный)
- The field array holding all the field options.
Список изменений
| С версии 5.0 | Введена. |
Код acf_field_post_object::get_posts() acf field post object::get posts ACF 6.4.2
public 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;
}