This might seem a little odd as a method.
I have posts on my wordpress website, which has a custom field called 'login_email'
In my theme files, I have this query...
$press = new WP_Query(array(
'posts_per_page' => -1,
'post_type' => 'download',
'post_status' => 'private',
'meta_query' => array(
array(
'key' => 'login_email',
'value' => $current_user->user_login,
'compare' => '='
)
)
));
This simply retrieves private posts which has the login_email custom field value which that matches $current_user->user_login
Currently in my login_email custom field i have this value...
[email protected]
No what I would like to be able to do is add more emails to this custom field seperate by a comma like this...
[email protected], [email protected], [email protected]
...and for my query above to be able to recognise one email out of this list.
For example if the user [email protected] is logged in, then because colins email exists in this custom field (along with josh & jimbo's email) then the post will be returned in the query.
I hope this makes some kind of sense. Let me know if I need to elaborate more.
It's like I need to modify the compare in the query - but these are the only options I can find...
compare (string) - Operator to test. Possible values are '=', '!=', '>', '>=', '<', '<=', 'LIKE', 'NOT LIKE', 'IN', 'NOT IN', 'BETWEEN', 'NOT BETWEEN', 'EXISTS' (only in WP >= 3.5), and 'NOT EXISTS' (also only in WP >= 3.5). Default value is '='. Source
...I've tested EXISTS but does not return any posts.
Has any one got a clever fix or idea?
Thanks Josh