I have made two dropdown list which is a custom fields.
Custom Field 1 :- industry
Values of Custom Field 1 :- financial_services,ecommerce,insurances, etc.
Custom Field 2 :- primary_functionality
Values of Custom Field 2 :-
platform_decision_engine,user_authentication,data_provider_verification
etc.
And My Post Type Name is :- providers.
Now, I want to fetch posts with multiple custom fields.
So, I have tried this query. But it's not working. How to pass array in values field because it's give me unexpected result.
Even I tried with for single custom field but it's also not working.
$search_args = array(
'posts_per_page' => -1,
'post_type' => 'providers',
'post_status' => 'publish',
'orderby' => 'title',
'order' => 'ASC',
'meta_query' => array(
'relation' => 'OR',
array(
'key' => 'industry',
'value' => $industry,
'compare' => 'IN'
),
array(
'key' => 'primary_functionality',
'value' => array('platform_decision_engine'),
'compare' => 'IN'
)
),
'suppress_filters' => true
);
}
$the_query_search = new WP_Query( $search_args );
This Query is not getting expected result.
EDIT :
[query] => Array
(
[posts_per_page] => -1
[post_type] => providers
[post_status] => publish
[meta_query] => Array
(
[0] => Array
(
[key] => industry
[value] => Array
(
[0] => ecommerce
)
[compare] => IN
)
)
)
Getting this array but data is not according to ecommerce.