Yoast\WP\SEO\Builders
Indexable_Hierarchy_Builder::is_invalid_ancestor() private Yoast 1.0
Checks if an ancestor is valid to add.
{} Это метод класса: Indexable_Hierarchy_Builder{}
Хуков нет.
Возвращает
true/false.
Использование
// private - только в коде основоного (родительского) класса $result = $this->is_invalid_ancestor( $ancestor, $indexable_id, $parents );
- $ancestor(Indexable) (обязательный)
- The ancestor to check.
- $indexable_id(число) (обязательный)
- The indexable id we're adding ancestors for.
- $parents(число[]) (обязательный)
- The indexable ids of the parents already added.
Код Indexable_Hierarchy_Builder::is_invalid_ancestor() Indexable Hierarchy Builder::is invalid ancestor Yoast 15.6.2
private function is_invalid_ancestor( Indexable $ancestor, $indexable_id, $parents ) {
// Don't add ancestors if they're unindexed, already added or the same as the main object.
if ( $ancestor->post_status === 'unindexed' ) {
return true;
}
$ancestor_id = $this->get_indexable_id( $ancestor );
if ( \array_key_exists( $ancestor_id, $parents ) ) {
return true;
}
if ( $ancestor_id === $indexable_id ) {
return true;
}
return false;
}