title: Join 2 search queries in wordpress Ajax function
body: <p>Hi I have tried everything to join the results of a common search with a sku search but nothing seems to work , it will either show the common search or the sku, not both, any help woulf be appreciated  </p>
  
  <pre><code>if (!function_exists('yolo_result_search_callback')) {
  function yolo_result_search_callback() {
      ob_start();
  
      $yolo_options = yolo_get_options();
      $posts_per_page = 8;
  
      if (isset($yolo_options['search_box_result_amount']) &amp;&amp; !empty($yolo_options['search_box_result_amount'])) {
          $posts_per_page = $yolo_options['search_box_result_amount'];
      }
  
      $post_type = array();
      if (isset($yolo_options['search_box_post_type']) &amp;&amp; is_array($yolo_options['search_box_post_type'])) {
          foreach($yolo_options['search_box_post_type'] as $key =&gt; $value) {
              if ($value == 1) {
                  $post_type[] = $key;
              }
          }
      }
  
      $keyword = $_REQUEST['keyword'];
  
      if ( $keyword ) {
  
  
      $search_query = array(
      'post_type' =&gt; 'product',
      'meta_query' =&gt; array(
          array(
              'key' =&gt; '_sku',
              'value' =&gt; $keyword,
              'posts_per_page' =&gt; $posts_per_page + 1,
              'compare' =&gt; 'LIKE',
              'relation' =&gt; 'OR',
              )
          )
          );
  
  
          $search_query = array(
              's'              =&gt; $keyword,
              'order'          =&gt; 'DESC',
              'orderby'        =&gt; 'date',
              'post_status'    =&gt; 'publish',
              'post_type'      =&gt; $post_type,
              'posts_per_page' =&gt; $posts_per_page + 1,
          );
  
          $search = new WP_Query($search_query);
  
          $newdata = array();
          if ($search &amp;&amp; count($search-&gt;post) &gt; 0) {
              $count = 0;
              foreach ( $search-&gt;posts as $post ) {
                  if ($count == $posts_per_page) {
                      $newdata[] = array(
                          'id'        =&gt; -2,
                          'title'     =&gt; '&lt;a href="' . site_url() .'?s=' . $keyword . '"&gt;&lt;i class="wicon icon-outline-vector-icons-pack-94"&gt;&lt;/i&gt; ' . esc_html__('View More','yolo-motor') . '&lt;/a&gt;',
                          'guid'      =&gt; '',
                          'date'      =&gt; null,
                      );
  
                      break;
                  }
                  $newdata[] = array(
                      'id'        =&gt; $post-&gt;ID,
                      'title'     =&gt; $post-&gt;post_title,
                      'guid'      =&gt; get_permalink( $post-&gt;ID ),
                      'date'      =&gt; mysql2date( 'M d Y', $post-&gt;post_date ),
                  );
                  $count++;
  
              }
          }
          else {
              $newdata[] = array(
                  'id'        =&gt; -1,
                  'title'     =&gt; esc_html__( 'Sorry, but nothing matched your search criteria. Please try again with some different keywords.', 'yolo-motor' ),
                  'guid'      =&gt; '',
                  'date'      =&gt; null,
              );
          }
  
          ob_end_clean();
          echo json_encode( $newdata );
      }
      die(); // this is required to return a proper result
  }
  add_action( 'wp_ajax_nopriv_result_search', 'yolo_result_search_callback' );
  add_action( 'wp_ajax_result_search', 'yolo_result_search_callback' );
  
   }
  </code></pre>