[wp-trac] [WordPress Trac] #57211: Split up `WP_Query::get_posts()`
WordPress Trac
noreply at wordpress.org
Sat Nov 26 15:37:55 UTC 2022
#57211: Split up `WP_Query::get_posts()`
-------------------------+----------------------------
Reporter: costdev | Owner: costdev
Type: enhancement | Status: assigned
Priority: normal | Milestone: Future Release
Component: Query | Version:
Severity: normal | Keywords: has-patch
Focuses: |
-------------------------+----------------------------
[https://developer.wordpress.org/reference/classes/wp_query/get_posts/#source
WP_Query::get_posts()] is a huge method at ~1650 lines. This makes it
quite hard to follow and maintain.
By splitting it up:
- It's easier to follow.
- It's easier to maintain.
- It's easier to write tests.
- Our scroll wheels will last a little longer.
As this is possibly the most critical method in Core, the aim of this
ticket is not to refactor the logic, but just to abstract functionality.
Changes to logic and such could be done later, in more maintainable code.
This should significantly reduce the chance of introducing regressions,
and hopefully mean that committing such a change can be done in the near
future. All new methods should have `private` visibility.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/57211>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list