I have two search queries. One searches in the default manner, for any post titles that match the arguments.
The second query is set to search any posts with the postmeta key of "SKU" LIKE the search query.
I am trying to combine these two queries so that the search will return any posts whose title OR sku match the search term.
First query:
$args = array(
's' => apply_filters('yith_wcas_ajax_search_products_search_query', $search_keyword),
'post_type' => 'product',
'post_status' => 'publish',
'ignore_sticky_posts' => 1,
'orderby' => $ordering_args['orderby'],
'order' => $ordering_args['order'],
'posts_per_page' => apply_filters('yith_wcas_ajax_search_products_posts_per_page', get_option('yith_wcas_posts_per_page')),
'meta_query' => array(
array(
'key' => '_visibility',
'value' => array('catalog', 'visible'),
'compare' => 'IN'
)
)
);
Second query:
$args = array(
'post_type' => 'product',
'post_status' => 'publish',
'ignore_sticky_posts' => 1,
'orderby' => $ordering_args['orderby'],
'order' => $ordering_args['order'],
'posts_per_page' => apply_filters('yith_wcas_ajax_search_products_posts_per_page', get_option('yith_wcas_posts_per_page')),
'meta_query' => array(
array(
'key' => '_visibility',
'value' => array('catalog', 'visible'),
'compare' => 'IN'
),
array(
'key' => '_sku',
'value' => apply_filters('yith_wcas_ajax_search_products_search_query', $search_keyword),
'compare' => 'LIKE'
)
)
);
How can I combine these two queries, and return any posts with the title or the sku matching the search term?