No, functionality for arrays is not guaranteed with the get_posts_sharing_custom_field_value()
function because array fields represent some architectural problems (mmm… might make a good feature request)… technically, the array fields store a JSON string that represents an array, so you could look for posts containing the same array, but that’s probably not what you want. It’s a limitation of the CCTM’s architecture, unfortunately, but it was the lesser of two evils. If your’e curious, here’s some of the thought process behind it: https://code.google.com/p/wordpress-custom-content-type-manager/wiki/CustomFieldsDataStructure
If you need a query that will query “repeatable” fields, I’d recommend using Summarize Posts’ GetPostsQuery class (included with the CCTM). It’s gotten more and more flexible, so you can give it arguments to match your query. It’s not streamlined for non-devs, but it should be working (eep! not sure if my unit tests are up-to-date for this). E.g. in your template file:
$args = array(); // initialize the array
$args['my_custom_field']['like'] = '"red"';
$Q = new GetPostsQuery();
$results = $Q->get_posts($args);
The trick here is if you supply it with a 2nd layer of the array, you can define your own operator AND notice the double-quotes around the value you’re searching for.
To clarify, this would search for all custom fields where the value was EQUAL to red:
$args['my_custom_field'] = 'red';
Or more verbosely:
$args['my_custom_field']['='] = 'red';
But if you want to search more flexibly, you can use other operators:
$args['my_custom_field']['starts_with'] = 'red';
The above might match custom fields that contained “red” or “redistribute” or “redo” etc.
But since the repeatable fields store data as JSON arrays, you have to remember that the values are actually stored like something like this:
["red"]
OR
["red","green","blue"]
So to search for those values, you first must use a different operator (“like” instead of “=”), AND you should include double-quotes in your search term. You can omit the latter step, but then you could get false-positives because searching for fields whose value is LIKE ‘%red%’ would match “bored”, “Bredy” etc.
Hope that makes sense. GetPostsQuery is so flexible it requires a lot more docs.