meta_query: check if number exists
I believe, more robust solution would be to allow multiple values of custom field ‘participants’. You can store like following add_post_meta($post_id,’participants’,’value1′); add_post_meta($post_id,’participants’,’value2′); add_post_meta($post_id,’participants’,’value3′); add_post_meta($post_id,’participants’,’value4′); Deletion would be like delete_post_meta($post_id,’participants’,’value1′); Query will then change to a simpler one. ‘meta_query’ => array( array( ‘key’ => ‘participants’, ‘value’ => $user_id, ‘compare’ => ‘=’, ), ) In case you … Read more