Support

Account

Home Forums General Issues Get the term ID from the taxonomy field set in the term object

Helping

Get the term ID from the taxonomy field set in the term object

  • Hi,
    i have a taxonomy field and return value is set to “term object”.
    I want to get the ID term but the code below no works.

    
    	$termine = get_field('scrittore');
    	$termine_id = $termine->id;
    	
    $terms = get_terms( array(
        'taxonomy' => 'pa_scrittore',
    	'number' => 10,
    	'orderby'    => 'count',
    	'order' => 'DESC',
    	'exclude' => $termine_id,
        'hide_empty' => false,
    ) );
    
    foreach ( $terms as $term ) {
    	
    //do stuff
    
    }
    

    Thanks

  • You may use $termine->term_id

Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘Get the term ID from the taxonomy field set in the term object’ is closed to new replies.