How to apply a function to a metadata value before launch a WP Query?
You can’t run arbitrary PHP functions in a query like that. WP_Query (which get_posts() uses) doesn’t retrieve posts then filter them with PHP, it gets turned into an SQL query which finds the results. The proper way to order meta_value by date in SQL would be to cast it as DATETIME. The way WP_Query allows … Read more