Yoast\WP\SEO\Repositories
Indexable_Hierarchy_Repository::find_children_by_ancestor_ids
Finds all the children by given ancestor id's.
Метод класса: Indexable_Hierarchy_Repository{}
Хуков нет.
Возвращает
Массив. List of indexable id's for the children.
Использование
$Indexable_Hierarchy_Repository = new Indexable_Hierarchy_Repository(); $Indexable_Hierarchy_Repository->find_children_by_ancestor_ids( $object_ids );
- $object_ids(массив) (обязательный)
- List of id's to get the children for.
Код Indexable_Hierarchy_Repository::find_children_by_ancestor_ids() Indexable Hierarchy Repository::find children by ancestor ids Yoast 28.0
public function find_children_by_ancestor_ids( array $object_ids ) {
if ( empty( $object_ids ) ) {
return [];
}
$children = $this->query()
->select( 'indexable_id' )
->where_in( 'ancestor_id', $object_ids )
->find_array();
if ( empty( $children ) ) {
return [];
}
return \wp_list_pluck( $children, 'indexable_id' );
}