Yoast\WP\SEO\Repositories
Indexable_Hierarchy_Repository::add_ancestor() public Yoast 1.0
Adds an ancestor to an indexable.
{} Это метод класса: Indexable_Hierarchy_Repository{}
Хуков нет.
Возвращает
true/false
. Whether or not the ancestor was added successfully.
Использование
$Indexable_Hierarchy_Repository = new Indexable_Hierarchy_Repository(); $Indexable_Hierarchy_Repository->add_ancestor( $indexable_id, $ancestor_id, $depth );
- $indexable_id(число) (обязательный)
- The indexable id.
- $ancestor_id(число) (обязательный)
- The ancestor id.
- $depth(число) (обязательный)
- The depth.
Код Indexable_Hierarchy_Repository::add_ancestor() Indexable Hierarchy Repository::add ancestor Yoast 16.1.1
public function add_ancestor( $indexable_id, $ancestor_id, $depth ) {
$hierarchy = $this->query()->create(
[
'indexable_id' => $indexable_id,
'ancestor_id' => $ancestor_id,
'depth' => $depth,
'blog_id' => \get_current_blog_id(),
]
);
return $hierarchy->save();
}