2 Different Taxonomy with Hierarchical Term Relationship
2 Different Taxonomy with Hierarchical Term Relationship
2 Different Taxonomy with Hierarchical Term Relationship
How to filter the terms to a special custom taxonomy?
Remove Custom Taxonomy Slug only without removing Custom post type slug in permalinks
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.
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
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
The category objects returned by get_categories() include a property of count: $lc->count
This question has the same solution as that one. The answer is short, so I post it here as well: In WordPress 3.9 (and still in 3.9.1) there’s a bug concerning the excluded terms in get_adjacent_post(). There’s a plugin to fix that bug.
When I Use function wp_insert_term() function it gives me Invalid taxonomy object
You could try using the terms_clauses filter function wpse156370_terms_clauses( $pieces, $taxonomies, $args ) { global $wpdb; $pieces[‘fields’] .= $wpdb->prepare( ‘, (SELECT COUNT(*) FROM ‘ . $wpdb->posts . ‘ p, ‘ . $wpdb->term_relationships . ‘ p_tr’ . ‘ WHERE p_tr.object_id = p.ID AND p_tr.term_taxonomy_id = tt.term_taxonomy_id’ . ‘ AND p.post_status = %s AND p.post_type = %s) … Read more