ACF_Field_Group::filter_postspublicACF 6.1

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

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

Хуков нет.

Возвращает

Массив.

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

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

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

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

Код ACF_Field_Group::filter_posts() ACF 6.4.2

public function filter_posts( $posts, $args = array() ) {
	// Loop over field groups and check visibility.
	$filtered = array();
	if ( $posts ) {
		foreach ( $posts as $post ) {
			if ( acf_get_field_group_visibility( $post, $args ) ) {
				$filtered[] = $post;
			}
		}
	}

	return $filtered;
}