Yoast\WP\SEO\Surfaces

Meta_Surface::for_posts()publicYoast 1.0

Returns the meta tags context for a number of posts.

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

Хуков нет.

Возвращает

Meta[]|false. The meta values. False if none could be found.

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

$Meta_Surface = new Meta_Surface();
$Meta_Surface->for_posts( $ids );
$ids(int[]) (обязательный)
The IDs of the posts.

Код Meta_Surface::for_posts() Yoast 22.4

public function for_posts( $ids ) {
	$indexables = $this->repository->find_by_multiple_ids_and_type( $ids, 'post' );

	if ( empty( $indexables ) ) {
		return false;
	}

	// Remove all false values.
	$indexables = \array_filter( $indexables );

	return \array_map(
		function ( $indexable ) {
			return $this->build_meta( $this->context_memoizer->get( $indexable, 'Post_Type' ) );
		},
		$indexables
	);
}