What do you want to save?
Add Code snippet
New code examples
-
Other 2021-10-03 23:56:07
get primary category of post wordpress
This is not a native wordpress feature, but a feature of Yoast SEO (see here). You can check for primary status the following way: <?php $term_list = wp_get_post_terms($post->ID, 'category', ['fields' => 'all']); foreach($term_list as $term) { ... Add solution