WordPress.org

Forums

Problem with the meta_query (1 post)

  1. tetedekiwi
    Member
    Posted 3 years ago #

    Hi

    I'm working on a website that that sells tires for vehicules and i'm at the step where i must use custom fields for the client to be at ease. I'm using the meta_query for my custom field and everything works fine for normal custom fields. The problem is that I have a custom field with data that is stored inside an array and I have problems to make my query for that.

    With a normal custom field, i'd do something like that:

    'meta_query' => array(
    array(
    'key' => 'size',
    'value' => '130',
    'compare' => '='
    )
    )

    But if the data is inside an array, how can I query that?

    The thing would look like that on my logic, but of course it doesn't work:

    'meta_query' => array(
    array(
    'key' => 'specifications["sub_key"]',
    'value' => 'winter',
    'compare' => '='
    )
    )

    Query like that doesn't work but that's exactly how I would like to use the query. So is there a way to achieve something like that?

    Thank you

Topic Closed

This topic has been closed to new replies.

About this Topic