Yoast\WP\SEO\Integrations\Watchers
Primary_Term_Watcher::delete_primary_terms() public Yoast 1.0
Deletes primary terms for a post.
{} Это метод класса: Primary_Term_Watcher{}
Хуков нет.
Возвращает
null.
Использование
$Primary_Term_Watcher = new Primary_Term_Watcher(); $Primary_Term_Watcher->delete_primary_terms( $post_id );
- $post_id(число) (обязательный)
- The post to delete the terms of.
Код Primary_Term_Watcher::delete_primary_terms() Primary Term Watcher::delete primary terms Yoast 15.6.2
public function delete_primary_terms( $post_id ) {
foreach ( $this->primary_term->get_primary_term_taxonomies( $post_id ) as $taxonomy ) {
$primary_term = $this->repository->find_by_post_id_and_taxonomy( $post_id, $taxonomy->name, false );
if ( ! $primary_term ) {
continue;
}
$primary_term->delete();
}
}