Untested and semi-pseudo code obviously. The idea is that a meta query is already an array of arrays, each field in your form is another nested array. If a value exists we push it onto the array. <?php $_location = $_GET['location'] != '' ? $_GET['location'] : ''; $_status = $_GET['status'] != '' ? $_GET['status'] : ''; // Etc for all form fields $meta_query = array(); // Declare empty array // Test each var for a value; if exists add to meta query array if($_location) $meta_query[] = array( 'key' => 'wpcf-location-area', 'value' => $_location, 'compare' => 'LIKE' ); if($_status) $meta_query[] = array( 'key' => 'wpcf-property-status', 'value' => $_status, 'compare' => 'LIKE' ); // Start the Query $property_args = array( 'post_type' => 'property-spaces', 'posts_per_page' => -1, 'meta_query' => $meta_query ); $propertySearchQuery = new WP_Query( $property_args );