ACF_Internal_Post_Type::filter_postspublicACF 6.1

Filter the posts returned by $this->get_posts().

Метод класса: ACF_Internal_Post_Type{}

Хуков нет.

Возвращает

Массив.

Использование

$ACF_Internal_Post_Type = new ACF_Internal_Post_Type();
$ACF_Internal_Post_Type->filter_posts( $posts, $args );
$posts(массив) (обязательный)
An array of posts to filter.
$args(массив)
An array of args to filter by.
По умолчанию: array()

Список изменений

С версии 6.1 Введена.

Код ACF_Internal_Post_Type::filter_posts() ACF 6.4.2

public function filter_posts( $posts, $args = array() ) {
	if ( ! empty( $args['active'] ) ) {
		$posts = array_filter(
			$posts,
			function ( $post ) {
				return $post['active'];
			}
		);
	}

	return $posts;
}