WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru Получай пассивный доход от сайта
функция не описана


Indexable_Ancestor_Watcher::get_children_for_term() public Yoast 1.0

Finds all child indexables for the given term.

{} Это метод класса: Indexable_Ancestor_Watcher{}

Хуков нет.


Массив. The list of additional child indexables for a given term.


$Indexable_Ancestor_Watcher = new Indexable_Ancestor_Watcher();
$Indexable_Ancestor_Watcher->get_children_for_term( $term_id, $child_indexables );
$term_id(int) (обязательный)
Term to fetch the indexable for.
$child_indexables(массив) (обязательный)
The already known child indexables.

Код Indexable_Ancestor_Watcher::get_children_for_term() Yoast 16.8

public function get_children_for_term( $term_id, array $child_indexables ) {
	// Finds object_ids (posts) for the term.
	$post_object_ids = $this->get_object_ids_for_term( $term_id, $child_indexables );

	// Removes the objects that are already present in the children.
	$existing_post_indexables = \array_filter(
		static function( $indexable ) {
			return $indexable->object_type === 'post';

	$existing_post_object_ids = \wp_list_pluck( $existing_post_indexables, 'object_id' );
	$post_object_ids          = \array_diff( $post_object_ids, $existing_post_object_ids );

	// Finds the indexables for the fetched post_object_ids.
	$post_indexables = $this->indexable_repository->find_by_multiple_ids_and_type( $post_object_ids, 'post', false );

	// Finds the indexables for the posts that are attached to the term.
	$post_indexable_ids       = \wp_list_pluck( $post_indexables, 'id' );
	$additional_indexable_ids = $this->indexable_hierarchy_repository->find_children_by_ancestor_ids( $post_indexable_ids );

	// Makes sure we only have indexable id's that we haven't fetched before.
	$additional_indexable_ids = \array_diff( $additional_indexable_ids, $post_indexable_ids );

	// Finds the additional indexables.
	$additional_indexables = $this->indexable_repository->find_by_ids( $additional_indexable_ids );

	// Merges all fetched indexables.
	return \array_merge( $post_indexables, $additional_indexables );