Sorting Custom Post Type by Meta Value but wont display when set to 0

SOLVED:

I had this in the function to save the meta data (like an idiot!!)

if ( !$value ) delete_post_meta( $post->ID, $key ); // Delete if blank

So it wasn’t saving the meta value if set to 0.

I changed it to:

if ( !$value ) add_post_meta( $post->ID, $key, '0' ); // add 0 if blank

Simple to solve… after hours of agony.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)