Find term based on id instead of slug, if you use numbers as term names it conflicts with the ids since has_term searches on id, slug and name when a string is passed but only on ids when integers are passed.
This commit is contained in:
parent
c43fa99ca0
commit
5f42ae6145
|
@ -384,7 +384,7 @@ function woocommerce_product_data_box() {
|
|||
$all_terms = get_terms( $attribute_taxonomy_name, 'orderby=name&hide_empty=0' );
|
||||
if ( $all_terms ) {
|
||||
foreach ( $all_terms as $term ) {
|
||||
$has_term = has_term( $term->slug, $attribute_taxonomy_name, $thepostid ) ? 1 : 0;
|
||||
$has_term = has_term( $term->term_id, $attribute_taxonomy_name, $thepostid ) ? 1 : 0;
|
||||
echo '<option value="' . $term->slug . '" ' . selected( $has_term, 1, false ) . '>' . $term->name . '</option>';
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue