get_col( $wpdb->prepare( " SELECT DISTINCT post_id FROM {$wpdb->postmeta} WHERE meta_value LIKE '%s' ", $keyword ) ); // Search in post_title and post_content $post_ids_post = $wpdb->get_col( $wpdb->prepare( " SELECT DISTINCT ID FROM {$wpdb->posts} WHERE post_title LIKE '%s' OR post_content LIKE '%s' ", $keyword, $keyword ) ); $post_ids = array_merge( $post_ids_meta, $post_ids_post ); // Query arguments $args = array( 'post_type' => 'post', 'post_status' => 'publish', 'post__in' => $post_ids, 'category_name' => 'item', ); $query = new WP_Query( $args ); if ( $query->have_posts() ): ?>
    have_posts() ) : $query->the_post(); ?>