I am looking to show search results from either product title or product tag name. I have implemented the product title search through the below code, but I need to add tag name search also into it. Please help me with this Wp_query.
Current code :
function iqonic_title_filter( $where, $wp_query ){
global $wpdb;
if( $search_term = $wp_query->get( 'iqonic_title_filter' ) ) :
$search_term = $wpdb->esc_like( $search_term );
$search_term = ' '%' . $search_term . '%'';
$title_filter_relation = ( strtoupper( $wp_query->get( 'title_filter_relation' ) ) == 'OR' ? 'OR' : 'AND' );
$where .= ' '.$title_filter_relation.' ' . $wpdb->posts . '.post_title LIKE ' . $search_term ;
endif;
return $where;
}
add_filter( 'posts_where', 'iqonic_title_filter', 10, 2 );
And I am using it as :
$args['iqonic_title_filter'] = $parameters['text'];
I have looked many answers, but none of them seems to work.