Yoast\WP\SEO\Builders
Indexable_Hierarchy_Builder::get_primary_term_id()
Returns the primary term id of a post.
Метод класса: Indexable_Hierarchy_Builder{}
Хуков нет.
Возвращает
int
. The ID of the primary term.
Использование
// private - только в коде основоного (родительского) класса $result = $this->get_primary_term_id( $post_id, $main_taxonomy );
- $post_id(int) (обязательный)
- The post ID.
- $main_taxonomy(строка) (обязательный)
- The main taxonomy.
Код Indexable_Hierarchy_Builder::get_primary_term_id() Indexable Hierarchy Builder::get primary term id Yoast 24.4
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 ); }