Yoast\WP\SEO\Repositories

Indexable_Hierarchy_Repository::find_children()publicYoast 1.0

Finds the children for a given indexable.

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

Хуков нет.

Возвращает

Массив. Array with indexable id's for the children.

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

$Indexable_Hierarchy_Repository = new Indexable_Hierarchy_Repository();
$Indexable_Hierarchy_Repository->find_children( $indexable );
$indexable(Indexable) (обязательный)
The indexable to find the children for.

Код Indexable_Hierarchy_Repository::find_children() Yoast 22.4

public function find_children( Indexable $indexable ) {
	$children = $this->query()
		->select( 'indexable_id' )
		->where( 'ancestor_id', $indexable->id )
		->find_array();

	if ( empty( $children ) ) {
		return [];
	}

	return \wp_list_pluck( $children, 'indexable_id' );
}