Skip to content

Instantly share code, notes, and snippets.

// What were searching for
$args = array(
'post_type' => $post_type,
'post_status' => 'publish'
);
// Now, if the category has been selected AND it doesn't equal the "show all" value
if(isset($_POST['category']) && $_POST['category'] != -1) {
// Explode the string into an array
$categories = array_map('intval', explode(',', $_POST['category']));