Here is the code I gathered off the internet so far:
$args = array( 'post_status' => 'publish', 'posts_per_page' => '5000', 'post_type' => 'post', 'meta_query' => array( 'relation' => 'AND', 'is_part_of_series' => array( 'key' => 'epic-series-select-series', 'value' => $series_id, 'compare' => '=', ), 'chapter_order' => array( 'key' => 'epic-series-chapter-number', 'compare' => 'EXISTS', ) ), 'orderby' => array( 'chapter_order' => 'ASC', ), );
but for some reason, this gets the correct 3 posts plus some other posts - which I have no idea why are present. I checked the meta table in
MySQL and only the correct 3 posts have the meta key with the value I am querying. Apparently, I am doing something wrong in the query! Any ideas?
I tried asking
ChatGPT for help but it did not.