Filter by Post Type

You can use WP_Query for that :

$contentTypes = explode(',', $_POST['contents']);
$qry = new WP_Query( array( 
'post_type' => $contentTypes
));

if( $qry->have_posts() ){
while( $qry->have_posts() ) {

$qry->the_post()
// Your code

}

}

Here is the [docs] ( https://codex.wordpress.org/Class_Reference/WP_Query ) for WP_Query

error code: 523