Get the values from an array string to work with post__in

Problem here is that, post_in accepts only array of post IDs and implode() returns string.

Here’s how fixed code should look like (also added few conditional checks):

$sel_ids = $_SESSION['selected_ids'];

/**
 * Check, if we have array of Post IDs
 */
if ( ! is_array( $sel_ids ) ) {
    return;
}

require_once('../../../../wp-load.php');

$args = array( 'post__in' => $sel_ids, 'post_type' => 'post' );
$posts = get_posts($args);

if ( empty( $posts ) ) {
    return;
}

foreach ($posts as $post) {
    echo get_the_post_thumbnail($post->ID, 'coverimage');
}