Skip to content

Commit

Permalink
Fix undefined and deprecated _usort_terms_by_name (#2345)
Browse files Browse the repository at this point in the history
Fixes #2344
  • Loading branch information
mihaijoldis authored and JustinSainton committed Oct 4, 2017
1 parent 090d48c commit 16c4fe0
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions wpsc-includes/misc.functions.php
Expand Up @@ -591,10 +591,15 @@ function get_the_product_category( $id ) {

$categories = wpsc_get_product_terms( $id, 'wpsc_product_category' );

if ( !empty( $categories ) )
usort( $categories, '_usort_terms_by_name' );
else
if ( !empty( $categories ) ) {
if ( function_exists( 'wp_list_sort' ) ) {
$categories = wp_list_sort( $categories, 'name', 'ASC' );
} else {
usort( $categories, '_usort_terms_by_name' );
}
} else {
$categories = array();
}

foreach ( (array)array_keys( $categories ) as $key ) {
_make_cat_compat( $categories[$key] );
Expand Down

0 comments on commit 16c4fe0

Please sign in to comment.