GET Taxonomy ID

If you’re on a taxonomy term archive page, you can access the current ID via get_queried_object_id(): echo function xyz( get_queried_object_id(), ‘product_cat’ ); You can also access the whole term object with get_queried_object(): $this_term = get_queried_object(); echo $this_term->term_id; echo $this_term->name; echo $this_term->description; echo $this_term->taxonomy; echo $this_term->parent; echo $this_term->count;

get_terms Parent Tags

The parent argument should do what you are asking. parent (integer) Get direct children of this term (only terms whose explicit parent is this value). If 0 is passed, only top-level terms are returned. Default is an empty string. http://codex.wordpress.org/Function_Reference/get_terms That is parent=14 should get all of the immediate children of term 14, but no … Read more

Getting Term_id – Taxonomy Metadata plugin

Alright, I have found a way. If it can be useful for someone here is how I solved it: $terms = get_the_terms( $post->ID , ‘custom_taxonomy’ ); if($terms) { foreach( $terms as $term ) { $term_id = $term->term_id; } } Then you can use $term_id in your expression.

How to add a new child category via an SQL statement?

Insert taxonomy terms via a raw SQL query is hard and discouraged, use the core wp_insert_term function, instead. Assuming you have an array of continent/countries terms: $countries_list = array( ‘Europe’ => array( ‘Austria’, ‘France’, ‘Italy’, ‘Germany’, ‘Spain’, ‘United Kingdom’ ) ); foreach ( $countries_list as $continent => $countries ) { // get term object for … Read more

Taxonomy Grid Archive Help?

To retrieve all the terms in a taxonomy, you can make use of get_terms Here is an example from that page to retrieve the term names of a custom taxonomy $terms = get_terms(‘my_taxonomy’, ‘hide_empty=0’); if ( !empty( $terms ) && !is_wp_error( $terms ) ){ echo “<ul>”; foreach ( $terms as $term ) { echo “<li>” … Read more