Trying to put an array into ‘post__in’ => array() query not working

You need to explode the string you obtain from $_GET['ids'] into an array, at the moment you a parsing a to string post__in rather than an array of IDs.

Try

$purchaseprodid = isset($_GET['ids']) ? explode(',',$_GET['ids']) : array();

However, you can sometimes run into difficulties using $_GET with WordPress, it’s better to use the API provided and register your variable, see this question.

Leave a Comment