Get posts having meta value between two numbers

Your question isn’t clear, but I’m making the following assumptions: The user is submitting $_POST[‘search_option_money’]; You want to return all mycredit posts where $_POST[‘search_option_money’]; is between the offer_money_start and offer_money_end custom fields. The problem is that you’re misusing the key and value arguments of the meta query. The key is the name of the custom … Read more

WordPress meta query with meta serialized data array value

Probably should have waited a bit but after posting the question I found a solution based on my points above and repeated here: https://codex.wordpress.org/Class_Reference/WP_Meta_Query https://generatewp.com/filtering-data-with-wp_meta_query/ My Solution: $metaSearchSubQuery = [ ‘relation’ => ‘OR’ ]; foreach($eventTypeId as $id) { $metaSearchSubQuery[] = [ ‘key’ => ‘EventId’, ‘value’ => serialize($id), ‘compare’ => ‘like’ ]; } $metaSearchQuery[] = $metaSearchSubQuery;