Order By Meta_key but convert custom date to Y-m-d first

I actually found a cool value for the orderby option in this case. meta_value_datetime It works the same as using strtotime and the date methods in PHP. So here is my final code that started working: $wp_query=new WP_Query(array ( ‘post_type’ => ‘sermon’, ‘meta_key’ => ‘sermon_date’, ‘orderby’ => ‘meta_value_datetime’, ‘order’ => ‘DESC’, ‘posts_per_page’ => -1 ) … Read more

WP User Query with Custom Fields and Search Results

Not sure if you ever found the answer, but just in case, I just did 🙂 There’s a hook I (finally!) found that lets you do this and works in a similar way to posts_where. The hook is pre_user_query. Here’s an example on the Codex: https://developer.wordpress.org/reference/hooks/pre_user_query/#user-contributed-notes With the above, your function could now look like … Read more