[wp-trac] [WordPress Trac] #35495: Allow `get_terms()` to return all terms, make `$taxonomy` parameter optional

WordPress Trac noreply at wordpress.org
Sat Feb 20 20:12:57 UTC 2016


#35495: Allow `get_terms()` to return all terms, make `$taxonomy` parameter
optional
--------------------------------------+--------------------
 Reporter:  flixos90                  |       Owner:
     Type:  enhancement               |      Status:  new
 Priority:  normal                    |   Milestone:  4.5
Component:  Taxonomy                  |     Version:  trunk
 Severity:  normal                    |  Resolution:
 Keywords:  has-patch has-unit-tests  |     Focuses:
--------------------------------------+--------------------

Comment (by boonebgorges):

 > Is it possible to pass $taxonomy here, to make it obvious which taxonomy
 is invalid?

 Yes, let's add this, in a separate changeset.

 > Also, could we perhaps use array_filter() for these taxonomy_exists()
 and is_taxonomy_hierarchical() checks? It should be just as fast and a bit
 cleaner to read.

 OK, but I would want to verify that there's full test coverage before
 making changes like this. May be worth a separate ticket.

 > By the way, what about making the same changes to get_term()?

 `get_term()` hasn't required the `$taxonomy` param since [34997].

 >  Can't we just name this parameter $deprecated, so that it's clear you
 should really only use get_terms( $args )?

 I didn't do this originally because I didn't want to throw a
 `_deprecated_argument()` notice. This would be extremely annoying for
 developers, especially this late in the cycle. (Maybe after 4.5 comes
 out.) But yes, I'm OK with the variable `$deprecated`.

 [attachment:35495.4.diff] is an updated patch.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/35495#comment:12>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list