title: How to get just the term_ids from get_the_terms in Wordpress
body: <p>I am building a wordpress website that uses a custom AJAX filter that is linked to my Custom categories.</p>
  <p>This is my function <strong>ajax-filter.php</strong>:</p>
  <pre><code>function filter() {
                 $results = array();
              
              
             if (!empty($the_query-&gt;posts))
             {
                 foreach ($the_query-&gt;posts as $post)
                 {
                     $id = $post-&gt;ID;
                     array_push($results, array(
                         'id' =&gt; $id,
                         'tax' =&gt; get_the_terms( $post-&gt;ID, 'type', $id ),
          
                     ));
                 }
             }
                wp_reset_postdata();
      
        $someJSON = json_encode($results);
        // Convert JSON string to Object
        $someObject = json_decode($someJSON);
  
        foreach($someObject as $key =&gt; $value) {
               echo $value-&gt;title;
          
              }
    die;
  }
    add_action( 'wp_ajax_filter', 'filter' );
    add_action( 'wp_ajax_nopriv_filter', 'filter' );
  </code></pre>
  <p>My question is:</p>
  <p>How can i use my data from <em>tax</em> to <em>term-id</em> in the way that i use in my <strong>ajax-filter.php?</strong> to use my data <strong>($value-&gt;title)</strong></p>
  <pre><code>Array
  (
      [0] =&gt; Array
            [title] =&gt; title
            [tax] =&gt; Array
                  (
                      [0] =&gt; WP_Term Object
                          (
                              [term_id] =&gt; 54
  )
  
                  )
  
          )
  </code></pre>