Site icon Hip-Hop Website Design and Development

How do i create a customized put up question when the meta worth is an array?

Numerous properties have been imported from an exterior API and saved right into a customized put up sort known as ‘Properties’.

I wish to filter these properties by the metropolis they’re positioned in, nonetheless it’s not so simple as simply having a meta key and worth I can question.

I’ve connected a picture beneath of the _addresses key and you may see the worth is a nested array and its in right here that metropolis is positioned:

The question I used to be utilizing is the next with the worth lacking, I do not suppose I can simply out town in right here, I’ve tried and it doesn’t work (word I’ve blanked out the values for confidentiality):

$meta_query[] = [
    'key' => '_addresses',
    'value' => **what goes here?**,
    'compare' => 'in',
];

Any assist can be appreciated, thanks.