How to filter products using filter products by attribute widget and OR logic between different product attribute types?

Issue #1 (nested tax_query with OR relation) After going through WordPress core and WooCommerce core, it appears query_type_bag-type=or (query_type_.$attribute) query arg is only changing the value of the operator key on the individual taxonomy array for the attribute. For example: query_type_pa_color=and = operator => ‘AND’ query_type_pa_color=or = operator => ‘IN’ You can see in the … Read more

How can i insert term in a specific language of Polylang?

You can actually make it this way: $cat1 = wp_insert_term( ‘Cat1’, ‘category’, [‘slug’ => ‘slug-cat1’], ); $agenda = wp_insert_term( ‘Agenda’, ‘category’, [ ‘slug’ => ‘slug-agenda’, ‘parent’=> term_exists( ‘Cat1’, ‘category’ )[‘term_id’], ], ); pll_set_term_language($cat1[‘term_id’], ‘fr’); pll_set_term_language($agenda[‘term_id’], ‘de’); Here is link to Polylang Function reference: https://polylang.wordpress.com/documentation/documentation-for-developers/functions-reference/

terms_description and admin problem

There is nothing in term_description() and deeper (that I see) that checks for user. You can try this and see if it returns WP_Error that might make term_description() return empty string: get_term_field( ‘description’, $term, $taxonomy )

List taxonomy terms for post as checkboxes

Try this: $jobsTerms = get_terms(‘jobtype’,array( ‘taxonomy’ => ‘jobtype’ )); foreach($jobsTerms as $term){ $checked = (has_term($term->slug, ‘jobtype’, $post->ID)) ? ‘checked=”checked”‘ : ”; echo “<label for=”term-” . $term->slug . “”>” . $term->name . “</label>”; echo “<input type=”checkbox” name=”term” . $term->slug . “” value=”” . $term->name . “” $checked />”; } Replace $post_id with whatever you need to … Read more

one term two taxonomy’s?

Had to write a method to do it. Here is the method… hope it helps someone else 😉 syntax: copy_terms($term->term_id, “taxonomy1”, “taxonomy2”, 0); //will copy to root of destination /** * Copy a term and its descendants from one taxonomy to another. * Both taxonomies have to be hierarchical. Will copy across * posts as … Read more

Which post does a taxonomy term belongs to?

You could do it using the term_link filter. Something roughly as follows: function my_term_link($termlink, $term, $taxonomy) { global $post; if ($taxonomy == ‘my-custom-taxonomy’) { return get_permalink( $post->ID ) . ‘#’ . $term->term_id; } } while ( $programtype->have_posts() ) : $programtype->the_post(); $terms = get_the_terms( $post->ID, ‘my-custom-taxonomy’ ); add_filter(‘term_link’, ‘my_term_link’, 10, 3); foreach ($terms as $term) { … Read more

Set attachment tags from attachment’s custom field data

I managed to make it work but not fully. First, the code you provided is not retrieving an already saved post_meta. I based my code in the introductory code of this tutorial: http://wpengineer.com/2076/add-custom-field-attachment-in-wordpress/ And am using the regular post_tag taxonomy instead of a custom one. And, lastly, there’s a bug, after you close the Media … Read more