An IN
query is not a string comparison query. It is more like a bunch of OR
statements.
... WHERE tablename.animal IN ('cat','dog','ferret')
is going to be the same as
...WHERE tablename.animal="cat"
OR tablename.animal="dog"
OR tablename.animal="ferret"
$_POST['_casestudypost']
is going to be an array, and if you stored it as a single value in postmeta it is going to be serialize
d. The array array("animal" => "cat");
when serialized will look something like a:1:{s:6:"animal";s:3:"cat";}
. Your actual $_POST['_casestudypost']
value will be similarly transformed. That is very far from what you need.
If you are going to be pulling by values, or key/value pairs, store each of your selected $_POST['_casestudypost']
values individually in the database– each value with its own line and not as a single key/value pair holding a serialized array.
If you don’t have to search by the value, then save the serialized array.
There is not enough context to your question for me to tell whether you really need to be searching by the value or not. There may be ways to get the result you want that you aren’t thinking about.