title: The query argument of wpdb::prepare() must have a placeholder
body: <p>I'm attempting to update some old code to use in a Wordpress plugin.</p>
  
  <p>What it is doing is taking the customer orders and checking if they have already purchased that Woocommerce product before. If it has, it will get the last purchase date. It actually works fine, but the query is dated. I would like to update it to work with Wordpress 4.5.</p>
  
  <p>I currently get the warning message (3 times): </p>
  
  <p>The query argument of wpdb::prepare() must have a placeholder</p>
  
  <pre><code>$orders = get_posts( array(
          'meta_key'    =&gt; '_customer_user',
              'meta_value'  =&gt; get_current_user_id(),
              'post_type'   =&gt; 'shop_order',
              'post_status' =&gt; array( 'wc-processing', 'wc-completed' )
      ) );
  
  $orders_id=wp_list_pluck( $orders, 'ID' ); //List of all order IDs
  
  $product_id = $post-&gt;ID; // Get current product ID
  
  $order_list='('.join(',', $orders_id).')';
  
  global $wpdb;
  
  $query_select_order_items = "SELECT order_item_id as id FROM {$wpdb-&gt;prefix}woocommerce_order_items WHERE order_id IN {$order_list}";
  
  $query_select_product_ids = "SELECT meta_value as product_id FROM {$wpdb-&gt;prefix}woocommerce_order_itemmeta WHERE meta_key=%s AND order_item_id IN ( $query_select_order_items )";
  
  $query_single_order_ids = "SELECT order_item_id FROM {$wpdb-&gt;prefix}woocommerce_order_itemmeta WHERE meta_key=%s AND meta_value=$product_id";
  
  $products = $wpdb-&gt;get_col( $wpdb-&gt;prepare ( $query_select_product_ids,'_product_id' ) );
  
  $order_item_id = $wpdb-&gt;get_col( $wpdb-&gt;prepare ( $query_single_order_ids, '_product_id' ) );
  
  $hg_abb_li1 = $wpdb-&gt;get_col( $wpdb-&gt;prepare ( $query_select_order_items, '_product_id' ) );
  
  $hg_abb_list1 = '('.join(',', $hg_abb_li1).')';
  $hg_abb_list2 = '('.join(',', $order_item_id).')';
  
  $query_select_hgabb_items = "SELECT order_id FROM {$wpdb-&gt;prefix}woocommerce_order_items WHERE order_item_id IN {$hg_abb_list1} AND order_item_id IN {$hg_abb_list2}";
  $hg_abb_orderid = $wpdb-&gt;get_col( $wpdb-&gt;prepare ( $query_select_hgabb_items, '_order_item_id' ) );
  
  $hg_abb_dateorderid = end($hg_abb_orderid);
  
  $query_select_hgabb_date = "SELECT post_date FROM {$wpdb-&gt;prefix}posts WHERE ID = {$hg_abb_dateorderid}";
  $l_order_date=$wpdb-&gt;get_col( $wpdb-&gt;prepare ( $query_select_hgabb_date, '_order_date' ) );
  
  $last_order_date = (($l_order_date[0]));
  </code></pre>
  
  <p>EDIT: So should it be something like?</p>
  
  <pre><code>$products = $wpdb-&gt;get_col( $wpdb-&gt;prepare ( "SELECT meta_value as product_id FROM ".$wpdb-&gt;prefix."woocommerce_order_itemmeta WHERE meta_key='_product_id' AND order_item_id IN ( SELECT order_item_id as id FROM ".$wpdb-&gt;prefix."woocommerce_order_items WHERE order_id IN (%s) )",$order_list ) );
  </code></pre>
  
  <p>and</p>
  
  <pre><code>$hg_abb_orderid = $wpdb-&gt;get_col( $wpdb-&gt;prepare ( 'SELECT order_id FROM '.$wpdb-&gt;prefix.'woocommerce_order_items WHERE order_item_id IN %s AND order_item_id IN %s', $hg_abb_list1, $hg_abb_list2 ) );
  </code></pre>
  
  <p>Can the %s (string?) still be used for arrays or won't that work?</p>