parent
d1f4177c97
commit
7583965af2
|
@ -247,8 +247,11 @@ function wc_product_post_type_link( $permalink, $post ) {
|
||||||
$terms = get_the_terms( $post->ID, 'product_cat' );
|
$terms = get_the_terms( $post->ID, 'product_cat' );
|
||||||
|
|
||||||
if ( ! empty( $terms ) ) {
|
if ( ! empty( $terms ) ) {
|
||||||
usort( $terms, '_usort_terms_by_ID' ); // order by ID
|
if ( function_exists( 'wp_list_sort' ) ) {
|
||||||
|
$terms = wp_list_sort( $terms, 'term_id', 'ASC' );
|
||||||
|
} else {
|
||||||
|
usort( $terms, '_usort_terms_by_ID' );
|
||||||
|
}
|
||||||
$category_object = apply_filters( 'wc_product_post_type_link_product_cat', $terms[0], $terms, $post );
|
$category_object = apply_filters( 'wc_product_post_type_link_product_cat', $terms[0], $terms, $post );
|
||||||
$category_object = get_term( $category_object, 'product_cat' );
|
$category_object = get_term( $category_object, 'product_cat' );
|
||||||
$product_cat = $category_object->slug;
|
$product_cat = $category_object->slug;
|
||||||
|
|
Loading…
Reference in New Issue