Hoist the numeric term check out of the is_object_in_term() loop - #13595
mukeshpanchal27 wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
🟢 Approval recommended
No unresolved issues were identified, and existing behavior is preserved.
Pull request overview
This pull request optimizes is_object_in_term() by moving numeric term preprocessing outside the object-term loop.
Changes:
- Computes
$numeric_strsonce before iteration. - Preserves existing term-matching behavior.
File summaries
| File | Description |
|---|---|
src/wp-includes/taxonomy.php |
Hoists numeric string normalization outside the loop. |
Review details
- Files reviewed: 1/1 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
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. |
Trac ticket: https://core.trac.wordpress.org/ticket/65818
is_object_in_term()rebuilt$numeric_strson every iteration of the$object_termsloop, callingarray_filter()andarray_map()once per term even though$strsnever changes inside the loop. For an object with several terms in a taxonomy, that is N redundant passes over the same input.Use of AI Tools
N/A
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.