Yoast\WP\SEO\Integrations\Watchers
Primary_Category_Quick_Edit_Watcher::get_primary_term_id() private Yoast 1.0
Returns the primary term id of a post.
{} Это метод класса: Primary_Category_Quick_Edit_Watcher{}
Хуков нет.
Возвращает
Число
. The ID of the primary term.
Использование
// private - только в коде основоного (родительского) класса $result = $this->get_primary_term_id( $post_id, $main_taxonomy );
- $post_id(число) (обязательный)
- The post ID.
- $main_taxonomy(строка) (обязательный)
- The main taxonomy.
Код Primary_Category_Quick_Edit_Watcher::get_primary_term_id() Primary Category Quick Edit Watcher::get primary term id Yoast 16.1.1
private function get_primary_term_id( $post_id, $main_taxonomy ) {
$primary_term = $this->primary_term_repository->find_by_post_id_and_taxonomy( $post_id, $main_taxonomy, false );
if ( $primary_term ) {
return $primary_term->term_id;
}
return \get_post_meta( $post_id, WPSEO_Meta::$meta_prefix . 'primary_' . $main_taxonomy, true );
}