Why does tax_query work, but meta_query doesn't?

by wasterel   Last Updated June 12, 2019 20:08 PM

$category = $_GET['category'];
$location = $_GET['location'];
$level = $_GET['level'];

/* Search Results Args */
$search_results_args = array();
$search_results_args['post_type'] = array(
    'post_type_1',
    'post_type_2'
);
/* Category */
if ($category != 'none') {
    $search_results_args['tax_query'] = array(
        'relation' => 'OR',
        array(
            'taxonomy' => 'post_type_1',
            'field' => 'slug',
            'terms' => $category
        ),
        array(
            'taxonomy' => 'post_type_2',
            'field' => 'slug',
            'terms' => $category
        )
    );
}
/* Level */
if ($level != 'none') {
    $search_results_args['meta_query'] = array(
        array(
            'key' => 'level',
            'value' => $advancend,
        )
    );
}


Related Questions


Updated July 25, 2018 19:08 PM

Updated July 14, 2015 13:03 PM

Updated June 28, 2019 01:08 AM

Updated February 09, 2019 13:08 PM

Updated July 15, 2019 10:08 AM