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.
EDIT 1:
Here is a screenshot of the only posts that have epic-series-select-series
meta key:
is_part_of_series
post meta into aseries
taxonomy it would provide enormous performance improvements and speed ups. Also5000
is a very very high number of posts, for reference the REST API limits to 100 max and Yoast SEO uses 1k as an upper limit for a limited query and a lot of sites struggle with that. Can you share the values you're searching for and their format?$series_id
I am searching for is32881