Ordering posts by custom field named “date” in backend
The main issue in your code is this part: $query->set(‘orderby’,’meta_value_date’); whereby you should use meta_value and not meta_value_date. (There is meta_value_num, but that’s not suitable for used with sorting by dates.) Then make sure the meta_type is set to DATE (which yes, you already done it correctly), and use the right date format — 10132020 … Read more