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 would like to go for an array implementation, you can store values as following
$array = array('value1','value2','value3');
update_post_meta($post_id,'participants',$array);
And search can be done like
'meta_query' => array(
array(
'key' => 'participants',
'value' => '"'.$userid.'"',
'compare' => 'LIKE',
),
)
Source for searching in serialized array
This way, it searches for the whole ID, including the double quotes
before and after it within the serialized array. No false positives
will be included.