Home Forums General Issues Problem with Query on custom field Reply To: Problem with Query on custom field

  • Hi @dadofgage

    I’ve just tested your code like the following on my end, and it has the leading ‘%’ in the query.

    $zip = 123456;
    $EXTRA[] = array( 
        'key' => 'mailing_zip', 
        'value' => $zip, 
        'compare' => 'LIKE' 
    $EXTRA['relation'] = 'OR';
    $EXTRA[] = array( 
        'key' => 'locator_address', 
        'value' => $zip, 
        'compare' => 'LIKE' 
    $meta_query = new WP_Meta_Query();
    $meta_query->parse_query_vars( array(
    				'meta_query' => 
    			) );
    $mq_sql = $meta_query->get_sql(

    Maybe there’s a custom function in your installation that modifies the query. Could you please try to reproduce the issue on one of the WordPress’ stock themes (like Twenty Fifteen) with other plugins deactivated? If it disappears, then you can activate the theme and plugins one by one to see which one causes the issue.

    Also, I believe this question is more related to WordPress than ACF. For further support, could you please ask it in the WordPress support forum?

    Thanks 🙂