get_terms() How many is TOO many?

Working on revamping a plugin of mine when I noticed that wp_count_terms() is not reflecting the same number as a call to count( get_terms() ) with the same $args passed. I’m pretty sure this is a bug in WordPress and I’ll submit a trac ticket in a little bit.

I wanted to get a solid working solution, so I ended up just making one call to get_terms() and then using count() on the array to get the count. My question is: “How many terms can be returned without slowing everything down”. It’s possible that there could be scaling issues here where there are a lot of terms in a taxonomy, but how many is TOO many? 1,000? 10,000? Just looking for a ballpark here.

Solutions Collecting From Web of "get_terms() How many is TOO many?"

Ad slowing down)

Lame answer: depends on your server and stuff.

Ad possible bug)

wp_count_terms(); is a level “above” get_terms(); and therefore has values like 'hide_empty' and 'fields' already set. I’d say: diff your $args against those predefinied by wp_count_term();. The later function does nothing than calling the get_terms() at it’s end.