Update post terms with custom taxonomy

Yes it is. But you have to know the exact taxonomy’s slug, since colors are not like preserved terms to be generated programmatically. Here is an example of how to do it: // run our function when a post is published add_action(‘save_post’,’update_my_taxonomies’); function update_my_taxonomies($post_id){ // Check if the post has a particular taxonomy if(has_term( ‘blue’, … Read more

Querying on multiple taxonomies pulled from $_GET checkbox array not working?

Here: $search_values[‘tax_query’] = array ( You’re resetting the value of tax_query for every item in the foreach loop. It’s also being set to an invalid value: Important Note: tax_query takes an array of tax query arguments arrays (it takes an array of arrays). This construct allows you to query multiple taxonomies by using the relation … Read more

get_terms ‘number’ parameter does not appear to work

So here’s some info for any other people with this issue. get_terms will not use the number parameter under certain conditions, such as if you pass in a parent parameter or if the hierarchical parameter is true. In these cases I have tried two workarounds, neither very good. You can call get_terms then do an … Read more

Avoid duplicate post from same Taxonomy

I see two ways to go about it, both quite similar. A) You can collect IDs of displayed posts in an array and then exclude those with post__not_in query parameter like so: $years_loop = get_terms( array( ‘taxonomy’ => ‘works_year’, ‘orderby’ => ‘slug’, ‘order’ => ‘DESC’, ) ); // array for displayed posts, we will update … Read more

How Can I Change a Taxonomy URL Based On The Originating URL?

The term_link filter has a different signature for its callback function than the page_link filter, meaning the arguments in your callback are different. (Also note you’ll need to explicitly set the argument number when you call add_filter because by default add_filter will only setup 1 argument. For example: add_filter( ‘term_link’, ‘lqd_series_link’, 10, 3 ); // … Read more