Make WordPress Core

Opened 2 years ago

Last modified 2 years ago

#54534 new enhancement

Introduce a get_term_by_args filter

Reported by: chouby's profile Chouby Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Taxonomy Keywords:
Focuses: Cc:

Description (last modified by SergeyBiryukov)

Since #21760 get_term_by() uses get_terms().

get_term_by() term query arguments are thus already filterable with the filter get_terms_args. However it's difficult to detect whether the arguments passed to the filter come from a call to get_term_by() or directly from a more generic call to get_terms().

I thus propose to add new filter specif to get_term_by().

Attachments (1)

54534.diff (625 bytes) - added by Chouby 2 years ago.

Download all attachments as: .zip

Change History (7)

@Chouby
2 years ago

#1 @pbiron
2 years ago

Thanx @Chouby, I think this is a good idea.

One note, tho: I think the ticket mentioned in the description is incorrect, because it doesn't have anything to do with get_term_by() :-) Can you double-check and correct?

#2 @Chouby
2 years ago

Maybe the proposed name is not the best. But the filter I propose is in the function get_term_by(), just before it calls get_terms().

#3 follow-up: @pbiron
2 years ago

Just to be clear: the proposed filter name seems fine. What I meant was that #27160 is related to TinyMCE and not get_term_by().

That is, the description of this ticket starts:

Since #27160 get_term_by() uses get_terms().

and that is not the correct ticket number where that change happened.

#4 @SergeyBiryukov
2 years ago

  • Description modified (diff)

Corrected the ticket number in the description.

#5 @pbiron
2 years ago

Thanx @SergeyBiryukov for using your "ninja trac searching skills" to find the correct ticket number :-)

Last edited 2 years ago by pbiron (previous) (diff)

#6 in reply to: ↑ 3 @Chouby
2 years ago

Replying to pbiron:

Just to be clear: the proposed filter name seems fine. What I meant was that #27160 is related to TinyMCE and not get_term_by().

Sorry I completely misunderstood your previous comment. Thanks @SergeyBiryukov :)

Note: See TracTickets for help on using tickets.