WordPress Custom Column Sorting

I have some custom columns in my post-edit screen all populated from custom meta. All the column sorting works bar this one.
This is my query and I’ve tried to sort this right but every time i try it just sorts by the $post->ID instead.

case 'price':
$query->set('meta_type', 'NUMERIC');
$query->set( 'meta_key', 'balancedue' );
$query->set( 'orderby', 'meta_value' );
break; 

I have a funny feeling that although my numbers are saved in the database as ##.## (pounds and pence), im not sure the sort likes them.

Related posts

Leave a Reply