This is more of a PHP than a WordPress issue:
If $newstring = '15,30';
then array($newstring)
is an array containing this string.
If you print_r( array($newstring) )
, it looks like this:
Array (
[0] => 15,30
)
Which is not the same as array(15,30)
.
What you want to do instead is:
$newstring = '15,30';
$args = array(
'post__in' => explode(',', $newstring)
);
print_r( explode(',', $newstring) )
will look like:
Array (
[0] => 15
[1] => 30
)
Which now is exactly the same as array(15,30)
.
See explode()
to better understand how this function works.