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:
Gerhard 2013-01-17 08:53:27 +02:00
parent c43fa99ca0
commit 5f42ae6145
1 changed files with 1 additions and 1 deletions

View File

@ -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>';
}
}