0

I have property listing on my page. i have to do filter on my page if user enter property guest value 5 then i need to fetch only that post where guest value is 5 that store in post meta value as a array.

Tthis is my query

$options = array(
        'post_type' => $post_type,
        'posts_per_page' => $posts_per_page,
        'order_by'  => $order_by,
        'order'     => $order,
        'meta_query' => array(
            array(
                'key' => 'property_detail',
                'value' => array ( 'property_guests'),
                'compare' => 'IN',
            )
        ),
    );

My meta key is property_detail and my meta value is in array

Array
(
    [property_guests] => 5
    [property_bedrooms] => 5
    [property_bedrooms_king] => 1
    [property_bedrooms_queen] => 1
    [property_bedrooms_twin] => 1
    [property_bedrooms_single] => 2
    [property_bathrooms] => 1
    [property_size] => 500
)

how to get post where property guest value is 5

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.