wordpress get taxonomy of a displayed item -


i`m writing wordpress theme. need display parents of current item belongs taxonomy. first thing need taxonomy of item displayed. here tried do:

$id = get_the_id(); $taxonomy = get_term_by('id', $id)['taxonomy']; echo 'current taxonomy ' . $taxonomy;  $terms = get_the_terms( $id, $taxonomy); for($i = count( $terms ) - 1; $i >= 0; $i--){     echo '><a href="' . get_term_link( $terms[$i] ) . '">' . $terms[$i]->name . '</a>'; } 

the first problem i`ve faced $taxonomy = "". please me.

you can terms wp_get_post_terms more informationclick here


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -