Yoast\WP\SEO\Builders
Indexable_Hierarchy_Builder::save_ancestors()
Saves the ancestors.
Метод класса: Indexable_Hierarchy_Builder{}
Хуков нет.
Возвращает
null
. Ничего (null).
Использование
// private - только в коде основоного (родительского) класса $result = $this->save_ancestors( $indexable );
- $indexable(Indexable) (обязательный)
- The indexable.
Код Indexable_Hierarchy_Builder::save_ancestors() Indexable Hierarchy Builder::save ancestors Yoast 24.7
private function save_ancestors( $indexable ) { if ( empty( $indexable->ancestors ) ) { $this->indexable_hierarchy_repository->add_ancestor( $indexable->id, 0, 0 ); return; } $depth = \count( $indexable->ancestors ); foreach ( $indexable->ancestors as $ancestor ) { $this->indexable_hierarchy_repository->add_ancestor( $indexable->id, $ancestor->id, $depth ); --$depth; } }