Loop returning only 1 result

Near the top of your code, you have wp_reset_postdata();. As explained in the Functional Reference it alter the main loop and should be avoided. Looks like that’s what’s causing your issue.

Any number in meta key (wp query)

You must use LIKE on the meta_key to support the SQL % pattern. The compare attribute only applies to the meta value. Instead you could try to filter it with: /** * Match any numbers in given a meta-key for WP_Query * * @see https://wordpress.stackexchange.com/a/177331/26350 */ ! is_admin() && add_filter( ‘posts_where’, function( $where ) { … Read more

Complex WP SQL Query

After hours of searching and testing I finally came to a solution. This code and SQL shows events with a parent id of 0 and is ordered by the dates of child events. Raw SQL cannot be used to replace the default way WP queries the database but there are always some kind of workaround … Read more