[ad_1]
I have registered metadata for my posts, and the metadata is an array containing numeric elements, for example, [1, 3, 5]. I need to use WP_Query to retrieve a list of posts based on the condition that this metadata array includes a specified value, such as 5. However, the code I’ve written is not successfully fetching the post data, and I’m not sure where the issue lies. I hope you can help me take a look.
$query_args = array(
'post_type' => 'work',
'posts_per_page' => 10,
'meta_query' => array(
array(
'key' => 'meta_key',
'value' => 5,
'compare' => '=',
),
),
);
$query = new WP_Query($query_args);
