ACF_Internal_Post_Type::get_posts
Returns an array of ACF posts for the given $filter.
Метод класса: ACF_Internal_Post_Type{}
Хуки из метода
Возвращает
Массив.
Использование
$ACF_Internal_Post_Type = new ACF_Internal_Post_Type(); $ACF_Internal_Post_Type->get_posts( $filter );
- $filter(массив)
- An array of args to filter by.
По умолчанию:array()
Список изменений
| С версии 6.1 | Введена. |
Код ACF_Internal_Post_Type::get_posts() ACF Internal Post Type::get posts ACF 6.4.2
public function get_posts( $filter = array() ) {
$posts = array();
// Check database.
$raw_posts = $this->get_raw_posts();
if ( $raw_posts ) {
foreach ( $raw_posts as $raw_post ) {
$posts[] = $this->get_post( $raw_post['ID'] );
}
}
/**
* Filters the posts array.
*
* @date 12/02/2014
* @since 5.0.0
*
* @param array $posts The array of ACF posts.
*/
$posts = apply_filters( "acf/load_{$this->hook_name_plural}", $posts, $this->post_type );
// Filter results.
if ( $filter && $posts ) {
return $this->filter_posts( $posts, $filter );
}
return $posts;
}