Skip to content

How to meta_query with meta values as serialize arrays #189

@huynhlongdev

Description

@huynhlongdev

$prefix = 'listing_options_';
CSF::createMetabox($prefix, array(
'title' => 'Options',
'post_type' => 'featured-listings',
'data_type' => 'serialize'
));
CSF::createSection($prefix, array(
'fields' => array(
array(
'id' => $prefix . 'types',
'type' => 'select',
'title' => 'Types',
'placeholder' => 'Select an option',
'options' => array(
'residential' => 'residential',
'land' => 'Land',
'lease' => 'Lease',
),
'default' => 'residential'
),
)
));

I used but code not working
$args['meta_query'] = array(
'relation' => 'AND',
array(
'key' => 'listing_options_types',
'value' => $cat,
'compare' => 'LIKE', // or =
),
);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions