Make WordPress Core

Changes between Initial Version and Version 4 of Ticket #54642


Ignore:
Timestamp:
12/17/2021 03:32:20 PM (3 years ago)
Author:
SergeyBiryukov
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #54642

    • Property Keywords has-patch added
  • Ticket #54642 – Description

    initial v4  
    11This requests scopes adding a query builder like API to WordPress, so that queries can be built across multiple functions, without needing to disable any PHPCS sniffs.
    22
    3 Currently, if the query is not completely being built nearby, developers will eventually have to disable phpcs sniff, since they would need to combine or interpolate queries. Some examples of this are present in WP core as well, such as in the [https://github.com/WordPress/wordpress-develop/blob/trunk/src/wp-includes/class-wp-meta-query.php#L668 meta query], [https://github.com/WordPress/wordpress-develop/blob/trunk/src/wp-includes/taxonomy.php#L1585 taxonomy] etc. Although WP does a great job generally to avoid disabling phpcs, in the general plugin ecosystem, these examples are more prevalent.
     3Currently, if the query is not completely being built nearby, developers will eventually have to disable phpcs sniff, since they would need to combine or interpolate queries. Some examples of this are present in WP core as well, such as in the [https://github.com/WordPress/wordpress-develop/blob/954e9c153fe9d1b4f74d76bab9dd5175fd36cebc/src/wp-includes/class-wp-meta-query.php#L668 meta query], [https://github.com/WordPress/wordpress-develop/blob/954e9c153fe9d1b4f74d76bab9dd5175fd36cebc/src/wp-includes/taxonomy.php#L1585 taxonomy] etc. Although WP does a great job generally to avoid disabling phpcs, in the general plugin ecosystem, these examples are more prevalent.
    44
    55Note that most of the examples of disabling phpcs can be refactored to not needing to disable. However, as far as I can tell, building a query this way (across multiple functions/places) is not considered a bad practice, if this assumption is correct then we should support doing it better.