In the get_posts method of WP_Query, there's a section relating to split_the_query
The logic of split_the_query is
$split_the_query = ( $old_request == $this->request && "$wpdb->posts.*" == $fields && !empty( $limits ) && $q['posts_per_page'] < 500 );
Which can be summarised as.
- The calculated query hasn't been modified ($old_request == $this->request)
- And we're just loading posts ("$wpdb->posts.*" == $fields)
- And we've set a limit (!empty( $limits ))
- And that limit is less than 500 rows ($q['posts_per_page'] < 500)
Then it triggers this bizarre alternative way to load content.
*Edit: * Maybe bizarre is a harsh word, I'm sure there's a purpose, it seems to update some caches in the process :)
It's causing issues with one of my custom post types as it also triggers some weird caching mechanism and I run out of memory.
I'm aware I can overwrite it with a hook but I'm wondering what the purpose of it is?
Doesn't seem to be documented. It also seems odd to randomly do it for less than 500 rows.