WPSEO_Primary_Term::get_primary_term()
Returns the primary term ID.
Метод класса: WPSEO_Primary_Term{}
Хуков нет.
Возвращает
int|true|false
.
Использование
$WPSEO_Primary_Term = new WPSEO_Primary_Term(); $WPSEO_Primary_Term->get_primary_term();
Код WPSEO_Primary_Term::get_primary_term() WPSEO Primary Term::get primary term Yoast 24.9
public function get_primary_term() { $primary_term = get_post_meta( $this->post_ID, WPSEO_Meta::$meta_prefix . 'primary_' . $this->taxonomy_name, true ); if ( ! $primary_term ) { return false; } $terms = $this->get_terms(); if ( ! in_array( (int) $primary_term, wp_list_pluck( $terms, 'term_id' ), true ) ) { $primary_term = false; } $primary_term = (int) $primary_term; return ( $primary_term ) ? ( $primary_term ) : false; }