search on the basis of string value of dropdown
-
Hi
I have added a custom dropdown of language in search form and its co responding custom field to job submission form. Its working fine but when I filter listing by language dropdown as I have stored language names as its value rather than numerical values , it does not filter queryhere is the code i tried
add_filter( 'job_manager_get_listings', 'filter_by_language_field_query_args', 10, 2 );function filter_by_language_field_query_args( $query_args, $args ) {
if ( isset( $_POST['form_data'] ) ) {
parse_str( $_POST['form_data'], $form_data );// If this is set, we are filtering by salary
if ( ! empty( $form_data['filter_by_language'] ) ) {
$language1 = sanitize_text_field( $form_data['filter_by_language'] );
$query_args['meta_query'][] = array(
'key' => '_job_language',
'value' => $language1,
'compare' => '=',
'type' => 'STRING'
);// This will show the 'reset' link
add_filter( 'job_manager_get_listings_custom_filter', '__return_true' );
}
}
return $query_args;
}is there any way to get it work ?
- The topic ‘search on the basis of string value of dropdown’ is closed to new replies.