Avoid PHP warnings with Midseason Transfers

When Midseason Transfers are used we have to convert the string values to integers (i.e. `'601.1'` to `601`) to avoid PHP warnings
This commit is contained in:
savvasha
2018-08-15 09:43:29 +03:00
committed by GitHub
parent 0038088858
commit be2c026f3f

View File

@@ -1473,10 +1473,12 @@ if ( ! function_exists( 'sp_sort_terms' ) ) {
* @return int Sorting order.
*/
function sp_sort_terms( $a, $b ) {
if ( is_int( $a ) ) {
if ( is_numeric( $a ) ) {
$a = intval( $a );
$a = get_term( $a );
}
if ( is_int( $b ) ) {
if ( is_numeric( $b ) ) {
$b = intval( $b );
$b = get_term( $b );
}
return get_term_meta( $a->term_id, 'sp_order', true ) > get_term_meta( $b->term_id, 'sp_order', true );