Taxonomy: Add 's' as an alias of 'search' in WP_Term_Query#11696
Taxonomy: Add 's' as an alias of 'search' in WP_Term_Query#11696wppoland wants to merge 2 commits intoWordPress:trunkfrom
Conversation
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
`WP_Query`, `WP_User_Query`, and `WP_Comment_Query` all accept `s` as a shorthand alias for `search`. `WP_Term_Query` did not, so authors switching between query classes were silently dropping their search criterion. This commit registers `s` as a recognized argument and copies it onto `search` when `search` is not explicitly set, preserving precedence for the long form. Adds tests covering: * `s` returning the same matches as `search`. * `search` taking precedence when both are provided. * `s` returning empty for no-match input. Complements WordPressGH-780 and WordPressGH-6746. See #51811.
| 'term_taxonomy_id' => '', | ||
| 'hierarchical' => true, | ||
| 'search' => '', | ||
| 's' => '', |
There was a problem hiding this comment.
Add @since for new variable.
| * @ticket 51811 | ||
| * @covers WP_Term_Query::parse_query |
There was a problem hiding this comment.
| * @ticket 51811 | |
| * @covers WP_Term_Query::parse_query | |
| * @ticket 51811 | |
| * | |
| * @covers WP_Term_Query::parse_query |
Update other tests as well
Trac ticket: https://core.trac.wordpress.org/ticket/51811
WP_Query,WP_User_Query, andWP_Comment_Queryall acceptsas a shorthand alias forsearch.WP_Term_Querydid not, so authors switching between query classes were silently dropping their search criterion.This PR registers
sas a recognized argument and copies it ontosearchwhensearchis not explicitly set, preserving precedence for the long form.Tests cover:
sreturns the same matches assearchsearchtakes precedence when both are providedsreturns empty for no-match inputComplements GH-780 and GH-6746.
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.