I have a $term_id = 123
and I want to find out on which page this term appears in the pagination. For example, we have:
$args = array(
'taxonomy' => 'hello',
'offset' => $offset,
'number' => 10, // total per page
'hide_empty' => false,
);
$term_query = new WP_Term_Query( $args );
And we get 1000 returned terms with 10 being displayed on each page. How do I find out on which page $term_id
exists?
Obviously, I can loop through all results and do a $term->term_id == $term_id
match and make a note of the iteration key, but I am hoping there is a more viable approach...?
While my case is specific to WP_Term_Query()
, this should apply to querying other object like posts etc.