Order by meta_key where meta_value is NUMBER
-
Hello all! How to resolve the next problem?
I have different numbers (prices) in post_meta field and I want to sort posts by this numbers. Problem is that type of this field is ‘LONGTEXT’ but not ‘INT’ or ‘FLOAT’ and sorting of posts occurs at the stage of processing the SQL-REQUEST. As result I have not correctly degree of posts/pages. (like 200, 30, 4, 57 but i want 4, 30, 57, 200) I can’t change the type of field, but I want to sort posts with PHP-code. I didn’t found any plugin, that can resolve this trouble. Can someone tell what to do in this case?P.S. Please, do not be surprised my English — I from Ukraine)
- The topic ‘Order by meta_key where meta_value is NUMBER’ is closed to new replies.