Categories
How can I always get the largest [term_id] from the given array?
Array ( [0] => WP_Term Object ( [term_id] => 49 ) [1] => WP_Term Object ( [term_id] => 65 ) [2] => WP_Term Object ( [term_id] => 11 ) )
Answer the question
In order to leave comments, you need to log in
$terms = get_the_terms( $post->ID, 'catalog'); foreach ( $terms as $term ) { $termID[] = $term->term_id; } $needTerm = max($termID);
Didn't find what you were looking for?
Ask a Question
731 491 924 answers to any question