Yoast\WP\SEO\Integrations\Watchers
Indexable_Ancestor_Watcher::reset_children() public Yoast 1.0
If an indexable's permalink has changed, updates its children in the hierarchy table and resets the children's permalink.
{} Это метод класса: Indexable_Ancestor_Watcher{}
Хуков нет.
Возвращает
true/false. True if the children were reset.
Использование
$Indexable_Ancestor_Watcher = new Indexable_Ancestor_Watcher(); $Indexable_Ancestor_Watcher->reset_children( $indexable, $indexable_before );
- $indexable(Indexable) (обязательный)
- The indexable.
- $indexable_before(Indexable) (обязательный)
- The old indexable.
Код Indexable_Ancestor_Watcher::reset_children() Indexable Ancestor Watcher::reset children Yoast 15.6.2
public function reset_children( $indexable, $indexable_before ) {
if ( ! \in_array( $indexable->object_type, [ 'post', 'term' ], true ) ) {
return false;
}
if ( $indexable->permalink === $indexable_before->permalink ) {
return false;
}
$child_indexable_ids = $this->indexable_hierarchy_repository->find_children( $indexable );
$child_indexables = $this->indexable_repository->find_by_ids( $child_indexable_ids );
\array_walk( $child_indexables, [ $this, 'update_hierarchy_and_permalink' ] );
if ( $indexable->object_type === 'term' ) {
$child_indexables_for_term = $this->get_children_for_term( $indexable->object_id, $child_indexables );
\array_walk( $child_indexables_for_term, [ $this, 'update_hierarchy_and_permalink' ] );
}
return true;
}