yoast_get_primary_term_id()
Get the primary term ID.
Хуков нет.
Возвращает
true|false|int
.
Использование
yoast_get_primary_term_id( $taxonomy, $post );
- $taxonomy(строка)
- The taxonomy to get the primary term ID for.
По умолчанию: category - $post(int|WP_Post|null)
- Post to get the primary term ID for.
По умолчанию: null
Код yoast_get_primary_term_id() yoast get primary term id Yoast 24.9
function yoast_get_primary_term_id( $taxonomy = 'category', $post = null ) { $post = get_post( $post ); $primary_term = new WPSEO_Primary_Term( $taxonomy, $post->ID ); return $primary_term->get_primary_term(); }