title: How to get wordpress category slug including Parent
body: <p>I have this code below to show get the slug of the current category, I also want it to get the parent of that category if there is one…</p>
  
  <pre><code>&lt;?php
   if (is_category( )) {
     $cat = get_query_var('cat');
     $yourcat = get_category ($cat);
     echo '&lt;link rel="canonical" href="http://www.xxxxx.com/'. $yourcat-&gt;slug.'/"&gt;';
   }
   ?&gt;
  </code></pre>
  
  <p>I want the parent category to then fit into this with the / as above. How can i do this?</p>