WP_Query used internally in get_pages()

In WordPress 6.3, the function get_pages() has been updated to utilize WP_Query internally, resolving a 13-year-old ticketticket Created for both bug reports and feature development on the bug tracker. (#12821). This modification significantly reduces the complexity of the get_pages() function by offloading the burden of querying databases and handling the cache to WP_Query. The change builds upon the previous enhancementenhancement Enhancements are simple improvements to WordPress, such as the addition of a hook, a new feature, or an improvement to an existing feature. introduced in #22176, which introduced query caching to WP_Query.

As a result, this update eliminates redundant code and ensures that all filters running in WP_Query are now also applied during the call to get_pages(). Users who leverage filters like posts_pre_query or posts_results to customize the behavior of WP_Query, such as retrieving data from alternative sources like cache or another database (e.g., elastic search), will benefit from this change.

Additionally, based on feedback from the glotpress team, a new filterFilter Filters are one of the two types of Hooks https://codex.wordpress.org/Plugin_API/Hooks. They provide a way for functions to modify data of other functions. They are the counterpart to Actions. Unlike Actions, filters are meant to work in an isolated manner, and should never have side effects such as affecting global variables and output. named get_pages_query_args has been added. This filter enables developers to modify the parameters passed to WP_Query, maintaining compatibility with the original parameter arguments.

See #56586 and #55806 for additional context.

Props to @flixos90 for peer review, to @stevenlinx and @leonnugraha for review.

#6-3, #dev-notes, #dev-notes6-3