Support

Account

Home Forums ACF PRO wp_query not work with numeric field

Unread

wp_query not work with numeric field

  • good morning,

    I give you an example to explain my problem:
    – I created a numeric custom field.
    – in the products the custom filed contains 0,29
    – the query below does not return products (if I remove the filter on the numeric field, it works)

    $args = array(
    ‘post_type’ => ‘product’,
    ‘post_status’ => ‘publish’,
    ‘orderby’ => ‘_price’,
    ‘order’ => “asc”,
    ‘posts_per_page’ => 1000,
    ‘paged’ => 1,
    ‘tax_query’ => array(
    ‘relation’ => ‘AND’,
    array (
    ‘taxonomy’ => ‘product_cat’,
    ‘field’ => ‘slug’,
    ‘terms’ => array(‘diamanti-sfusi’),
    ‘operator’ => ‘IN’
    ),
    ),
    ‘meta_query’ => array(
    ‘relation’ => ‘AND’,
    array(
    ‘key’ => ‘stone_carat’,
    ‘value’ => 0.10,
    ‘type’ => ‘NUMERIC’,
    ‘compare’ => ‘>’
    )

    )
    );

Viewing 1 post (of 1 total)

The topic ‘wp_query not work with numeric field’ is closed to new replies.