Saturday, July 23, 2022
HomeWordPress Developmentwp question - meta_query bizarre behaviour, static int will work, however not...

wp question – meta_query bizarre behaviour, static int will work, however not consumer information


I’m at present making an attempt to construct a Ajax filter for a CPT, all of the merchandise have a min and max worth of a selected vary during which the merchandise works greatest. Due to this fact i created ACF teams with a min and max worth as a quantity area.

When i’m making an attempt so as to add the meta_query with the static values listed beneath, i’m able to discover the corresponding product, nonetheless when i change the 1,200 with the $min and $max (they’re for certain integers) the question returns 0 merchandise and would not discover the product.

I don’t know how that is doable, as i’m feeding the very same kind to the question. Any thought what may cause this concern?

foreach ($filter_data as $information ) {

    $stripped_id = str_replace('slider-', '', $information['id']);
    $stripped_id = str_replace('-range', '', $stripped_id);   

    $min = intval($information['min']);
    $max = intval($information['max']);

    array_push( $metaquery, array(
        'key'       => 'ultimate-torque_min',
        'worth'     => array( 1, 200 ),
        'examine'   => 'BETWEEN',
        'kind'      => 'NUMERIC'
    ));

    array_push( $metaquery, array(
        'key'       => 'ultimate-torque_max',
        'worth'     => array( 1, 200 ),
        'examine'   => 'BETWEEN',
        'kind'      => 'NUMERIC'
    ));

}

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments