Opened 8 years ago
Last modified 7 years ago
#39120 new enhancement
Add get/set methods to remaining main query classes (comments and terms)
Reported by: | Offereins | Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | normal | Version: | |
Component: | Query | Keywords: | has-patch has-unit-tests |
Focuses: | Cc: |
Description
Interacting with the $query_vars
property in WP_Query
or WP_User_Query
is handled through the get()
and set()
methods. It would be great if this could be a unified generic interface for WP's other main query classes, WP_Comment_Query
and WP_Term_Query
.
Patches attached.
Attachments (7)
Change History (9)
#1
@
7 years ago
- Keywords has-patch has-unit-tests added
I agree with @Offereins here, I think it's good to have a get/set methods consistency in the query classes.
Above I attached the Tests_Comment_Query::test_get_and_set()
and Tests_Term_Query::test_get_and_set()
tests based on the Tests_User_Query::test_get_and_set()
test.
I also updated the patches, based on the WP_User_Query::get()
discussion here:
https://core.trac.wordpress.org/ticket/21426
regarding the null vs empty string return value for non-existing query variables.
#2
@
7 years ago
The 39120.diff patch:
- combines all the above patches + tests into a single patch.
- removes
@access public
from the docBlocks. - Adds comments to tests.
- Adjustments according to the Coding Standard.
Comment Query methods