hello, i have a filterable archive page here: hidden link
i have a search field called "Ordering Part Number"
I want this field to filter such that the filter checks to see if the string entered is in any of these custom fields:
Ordering Part Number
Catalog Part number
Old Catalog Part number
to do so, i'm using this: https://toolset.com/documentation/programmer-reference/views-filters/#wpv_filter_query
here is the code i've made: hidden link
function tb_search_multi_fields( $query_args, $view_settings, $views_id ) {
// !isset($_GET['wpv_filter_submit'])
// $_GET['action'] == "wpv_get_archive_query_results" &&
// 9701773300
if ( $_GET['action'] == "wpv_get_archive_query_results" ) { // if it is specific view and by default
$value = $_GET["search"]["dps_general"][4]["value"];
$query_args['meta_query'][] = array(
'relation' => 'OR',
array(
'key' => 'wpcf-ordering-part-number',
'value' => $value,
'compare' => 'LIKE'
),
array(
'key' => 'wpcf-catalog-part-number',
'value' => $value,
'compare' => 'LIKE'
),
array(
'key' => 'wpcf-old-catalog-part-number',
'value' => $value,
'compare' => 'LIKE'
)
);
}
return $query_args;
}
add_filter( 'wpv_filter_query', 'tb_search_multi_fields', 101, 3 );
I think I am doing this correctly, but it always shows no results. Could you help explain why this is happening?
I think you will need to log in. to do so simple CLICK HERE to be logged in automatically: hidden link
edit: to further clarify, if i search for "9701773300" this result should appear: hidden link