How do I do a 'like' comparison on a numeric value with meta_query?
I have some code that does an autocomplete search for product sku's in WooCommmerce. It works fine for non numeric skus, but I can't get it working with numeric skus. I'm using compare => 'like' because my autocomplete script is setup to start searching after 2 characters have been entered (so that skus 10 characters long can be searched instead of entered exactly). Here's what I'm working with now:
$products1 = array( 'post_type' => array ('product', 'product_variation'), 'post_status' => 'publish', 'posts_per_page' => -1, 'meta_query' => array( array( 'key' => '_sku', 'value' => $_REQUEST['term'], 'compare' => 'LIKE' ) ), 'fields' => 'ids' );