title: Get primary category if more than one is selected?
body: <p>In Wordpress, how can I revert to the primary category?</p>
  
  <p>I'm using the following loop, if all three are checked then it just reverts to the last term. I want to make sure it's the primary category.</p>
  
  <pre><code>&lt;?php $term_list = wp_get_post_terms($post-&gt;ID, 'category', array("fields" =&gt; "names"));
  foreach ($term_list as $term) {
      $name = $term;
  } ?&gt;
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/2VcaN.png" rel="noreferrer"><img src="https://i.stack.imgur.com/2VcaN.png" alt="enter image description here"></a></p>