• Hi guys,
    I used get_the_terms function to get terms of a custom post type and the response was an array of objects with term_id as keys for eg :

    Previous

    Array ( [57] => stdClass Object ( [term_id] => 57 [name] => Premium [slug] => premium [term_group] => 0 [term_taxonomy_id] => 61 [taxonomy] => support-type [description] => [parent] => 0 [count] => 1 ) [56] => stdClass Object ( [term_id] => 56 [name] => Standard [slug] => standard [term_group] => 0 [term_taxonomy_id] => 60 [taxonomy] => support-type [description] => [parent] => 0 [count] => 8 ) )

    But this response has changed now and the key is starting from 0.

    Now

    Array ( [0] => stdClass Object ( [term_id] => 57 [name] => Premium [slug] => premium [term_group] => 0 [term_taxonomy_id] => 61 [taxonomy] => support-type [description] => [parent] => 0 [count] => 1 ) [1] => stdClass Object ( [term_id] => 56 [name] => Standard [slug] => standard [term_group] => 0 [term_taxonomy_id] => 60 [taxonomy] => support-type [description] => [parent] => 0 [count] => 8 ) )

    A function was written based on keys (which was term_id at first) at development stage, but since the behavior of get_the_terms has changed now, my custom function results in an error.

    Can anyone help why response of get_the_terms has changed ?

The topic ‘Issue the get_the_terms’ is closed to new replies.