Since you are querying for multiple meta_key’s, you will want to put your meta_key queries in an array. A good example is this posting on StackExchange.
For each of your functions you’ll want to replace the last three lines where you set the ['meta_key']
, ['meta_value']
, and ['meta_relation']
with something like this:
if( ! isset($query->query_vars['meta_query']) ) {
$query->query_vars['meta_query'] = array();
}
// setup this functions meta values
$meta = array (
'key' => 'dt_module_no',
'value' => $mod_no,
'compare' => 'LIKE'
);
// append to meta_query array
$query->query_vars['meta_query'][] = $meta;
By default each array in the meta_query will be ‘AND’ed in the query.
This code is untested.