title: Wordpress using get_term to retrieve slug not working as expected
body: <p>I'm using the below code to try and get the slug for the current category and the parent category.</p>
  
  <p>I've managed to get as far as getting the currently cat slug but the parent displays in readable text and nut slug format.</p>
  
  <p>Where am I going wrong?</p>
  
  <pre><code>    &lt;?php $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) ); 
      $parent = get_term($term-&gt;parent, get_query_var('taxonomy') );?&gt;
  
          &lt;?php echo do_shortcode("[ecs-list-events cat='{$term-&gt;slug}']"); ?&gt;   
  
       &lt;?php 
      echo $term-&gt;slug; 
      echo $parent-&gt;name;
      ?&gt;
  </code></pre>