WordPress – get_terms() returns “invalid taxonomy” (this is not a hook issue)

On my local machine it works fine, but on the live server, when I run

get_terms('taxonomy' => 'any_taxonomy');

it returns a list of terms, but if I add any parameter to it like:

Read More
get_terms('taxonomy' => 'any_taxonomy','hide_empty' => false);

Then it returns “invalid taxonomy”. The issue is not that the taxonomy is not registerd get_taxonomies() before it, it shows that all the taxonomies are registered. If I do this:

    get_terms('taxonomy' => 'category','hide_empty' => false);

The same problem is there, so its not just custom taxonomies.

Any idea what could be causing this issue?

Can anyone suggest a way to diagnose this?

Related posts

Leave a Reply

1 comment

  1. i’d say you are running different versions of wordpress, 4.5 changed the functionality of get_terms()

     get_terms(  array('taxonomy' => 'any_taxonomy','hide_empty' => false) );
    

    Should work, but i also think if you are calling get_terms() before registering your taxonomy is going to cause issues.