Allow user to set custom order to a list of custom taxonomies?

For those interested I figured it out. I added this to my functions.php: function set_the_terms_in_order ( $terms, $id, $taxonomy ) { $terms = wp_cache_get( $id, “{$taxonomy}_relationships_sorted” ); if ( false === $terms ) { $terms = wp_get_object_terms( $id, $taxonomy, array( ‘orderby’ => ‘term_order’ ) ); wp_cache_add($id, $terms, $taxonomy . ‘_relationships_sorted’); } return $terms; } add_filter( … Read more

Getting Term ID from Term Name for WordPress Query

Check for variables names: $excludes=””; if($filtering_excludes) { $exclude_terms = explode(“, “, $filtering_excludes); foreach ($exclude_terms as $exclude_term) { $term = get_term_by( ‘name’, $exclude_term, $filtering_tax ); $exclude_term_array[] = $term->term_id; } $excludes= implode(“, “, $exclude_term_array); }

Show posts from two or more custom taxonomy terms

You need to combine two tax queries with and AND relation: $args = array( ‘posts_per_page’ => 10, // Number of posts per page ‘post_type’ => ‘classifieds’, // Custom Post Type like Movies ‘tax_query’ => array( ‘relation’ => ‘AND’ array( ‘taxonomy’ => ‘classifieds_tags’, //Custom Taxonomy Name like Genre ‘field’ => ‘slug’, ‘terms’ => array( ‘books’ //Tags … Read more

Changing taxonomy term by slug (wp_update_term)

As you hinted in your question, you could use get_term_by() to return an object or array containing the term’s id, then use it to update that term. Something like this should work: $your_term = get_term_by( ‘slug’, ‘your_slug’, ‘your_taxonomy’ ); if ( false !== $your_term ) { wp_update_term( $your_term->term_id, ‘your_taxonomy’, $args ); } References: http://codex.wordpress.org/Function_Reference/get_term_by http://codex.wordpress.org/Function_Reference/wp_update_term

Use get_terms to get post_tags but limit to a taxonomy

I’m fairly certain that the taxonomies have nothing truly in common except posts that they share, so I think you can’t avoid running an actual query of posts, in order to learn which categories are candidates for your criteria. While, it may not be computationally the best method, you could do something like this… $args … Read more

Output terms to post_class()

The easiest and most straight-forward way to do this would be: $tax_terms = get_the_terms( $post->ID, array(‘genre’) ); $tax_terms = wp_list_pluck($tax_terms,’slug’); post_class(implode(‘ ‘,$tax_terms)); You could also apply a filter to post_class that does essentially the same. function tax_classes_wpse_105386($classes) { global $post; $tax_terms = get_the_terms( $post->ID, array(‘genre’) ); $tax_terms = wp_list_pluck($tax_terms,’slug’); $classes = array_merge($classes,$tax_terms); return $classes; } … Read more