From 16c4fe05fd285ac645c8498a956cc527b87ec15c Mon Sep 17 00:00:00 2001 From: Joldis Mihai Alexandru Date: Wed, 4 Oct 2017 19:08:57 +0300 Subject: [PATCH] Fix undefined and deprecated _usort_terms_by_name (#2345) Fixes #2344 --- wpsc-includes/misc.functions.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/wpsc-includes/misc.functions.php b/wpsc-includes/misc.functions.php index 317ff98a71..281b7631a1 100755 --- a/wpsc-includes/misc.functions.php +++ b/wpsc-includes/misc.functions.php @@ -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] );