The issue with using WP_Query
-
I have registered metadata for my posts, and the metadata is an array containing numeric elements, for example, [1, 3, 5]. I need to useWP_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);
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘The issue with using WP_Query’ is closed to new replies.