Development,  WordPress

Get_terms and invalid taxonomy

Funny thing, I was building application and I used get_terms to get list of certain taxonomies. It all works well on my localhost… where I got WordPress 4.5 installed. I’ve uploaded this code onto client’s staging server and…
Ba Dum Tss!
Yeah, I got “Invalid taxonomy” error. What the hell? – I asked myself. And then I answered myself – oh, yeah, client has WordPress 4.4… and I used this construction:


And this is ok, for WordPress 4.5. For older WordPresses and to keep compatibility, use this:

This one will work for WordPress 4.5 and for older ones, too.

One Comment

Leave a Reply

Your email address will not be published. Required fields are marked *