acf_field_post_object::get_posts()publicACF 5.0.0

get_posts

This function will return an array of posts for a given field value

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

Хуков нет.

Возвращает

$value.

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

$acf_field_post_object = new acf_field_post_object();
$acf_field_post_object->get_posts( $value, $field );
$value (обязательный)
-
$field (обязательный)
-

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

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

Код acf_field_post_object::get_posts() 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;

}