Yoast\WP\SEO\Integrations
Primary_Category::get_primary_category() protected Yoast 1.0
Get the id of the primary category.
{} Это метод класса: Primary_Category{}
Хуков нет.
Возвращает
Число. Primary category id.
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->get_primary_category( $post );
- $post(WP_Post) (обязательный)
- The post in question.
Код Primary_Category::get_primary_category() Primary Category::get primary category Yoast 15.6.2
protected function get_primary_category( $post ) {
$primary_term = new WPSEO_Primary_Term( 'category', $post->ID );
return $primary_term->get_primary_term();
}