[wp-trac] [WordPress Trac] #45085: different args passed to "term_name" and "term_{$field}" filters
WordPress Trac
noreply at wordpress.org
Thu Oct 11 16:46:32 UTC 2018
#45085: different args passed to "term_name" and "term_{$field}" filters
----------------------------------+-----------------------------
Reporter: pbiron | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Taxonomy | Version:
Severity: normal | Keywords:
Focuses: docs, administration |
----------------------------------+-----------------------------
In `/wp-admin/edit-tags.php`, for each row in the `WP_Term_List_Table`,
both
[[https://developer.wordpress.org/reference/hooks/term_name/|term_name]]
and
[[https://developer.wordpress.org/reference/hooks/term_field/|term_{$field}]]
(with `$field == 'name'`) get applied before the term's name is displayed
in the table.
As far as I can tell, there is no way to hook into `term_name` without
also hooking into `term_{$field}` (when `$field == 'name'`).
When `term_name` is applied, the 2nd argument is a `WP_Term` object; when
`term_{$field}` (when `$field == 'name'`) is applied, the 2nd argument is
an int (`term_id`).
Given that both of these filters have been around for **many** years, I
don't think it would be a good idea to change either one of them so that
their argument lists were the same. However, I think it would be a good
idea to add some explanation of this conflict in the DocBlocks of both
filters.
Of course, I could add comments to both entries in the Code Reference, but
I think it would be **much** better if that explanation were in the
DocBlocks.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/45085>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list