[wp-trac] [WordPress Trac] #55358: Passing int term term_exists parent param not respected
WordPress Trac
noreply at wordpress.org
Wed May 7 23:11:19 UTC 2025
#55358: Passing int term term_exists parent param not respected
-------------------------------------------------+-------------------------
Reporter: spacedmonkey | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Future
| Release
Component: Taxonomy | Version:
Severity: normal | Resolution:
Keywords: good-first-bug has-patch needs- | Focuses:
unit-tests |
-------------------------------------------------+-------------------------
Comment (by nickbrazilian):
Replying to [comment:8 spacedmonkey]:
> This ticket needs unit tests.
Hello, i was going to apply the patch and test it, but noticed the
codebase changed a LOT.
A wrote a plugin to test if the term_exists() function now properly checks
if a term exists under a specified parent when using a term ID.
Testing involved creating a parent term and a child term within a
hierarchical taxonomy (e.g., Categories). The child term’s ID was passed
to term_exists() alongside the parent’s ID. The function returned the
child term’s data only if it was correctly nested under the parent,
confirming the parent parameter is respected. This proves the original
issue (parent check being ignored) no longer occurs. The ticket can be
closed.
The plugin that i used to test is here:
https://github.com/N1co1asB1ancon1/test_term_exists_work_wp_bug
You have to create a parent and a child in the posts->category, put their
respective ID's into the plugin and execute the plugin, for me it printed:
Testing `term_exists()` with child slug (123) and parent ID (2) in
taxonomy "category": Result: Found term and respected parent. (Expected
correct behavior)
That it guys, what do you think of it? Mind you, this is my very first
ever OS contribution. Thank you
--
Ticket URL: <https://core.trac.wordpress.org/ticket/55358#comment:9>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list