Using custom meta_query with relation not working as expected

You’re getting all the posts because you set 'meta_key' => 'event_date'.

This is equivalent to adding another subquery into ‘meta_query’ that says “get me all posts which have an event_date custom field, with any value OR that have even_date to $today etc.”.

PS: There are many event plugins out there that have already figured all this stuff out. Give them a try or at least look at their code.

Leave a Comment