[wp-trac] [WordPress Trac] #37825: Introduce functions to check whether there are multiple taxonomy terms
WordPress Trac
noreply at wordpress.org
Sun Sep 11 09:21:42 UTC 2016
#37825: Introduce functions to check whether there are multiple taxonomy terms
-------------------------------------------------+-------------------------
Reporter: flixos90 | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting
Component: Themes | Review
Severity: normal | Version:
Keywords: has-patch 2nd-opinion needs-unit- | Resolution:
tests | Focuses:
-------------------------------------------------+-------------------------
Comment (by flixos90):
Replying to [comment:3 boonebgorges]:
> Idea seems OK to me, if it is in fact true that theme authors would find
it useful. I don't fully grasp the utility of it, but I also don't fully
grasp the utility of `is_multi_author()` :) Do you have examples of themes
that are implementing this logic on their own?
Actually, most recent default themes did. See
https://github.com/WordPress/twentysixteen/blob/master/inc/template-
tags.php#L201 for example. They only do that for categories, but the above
implementation would of course also cover that, and in addition also help
theme developers that create custom themes for support of custom
taxonomies.
Regarding the naming conventions, good point with the
`is_multi_taxonomy()` name, your approach is certainly more clear. About
the underscore prefix, when was this decided? It feels to me that if we
don't do that anymore, the function won't be "marked" as private anymore
(although of course it's technically not private anyway). I have always
felt like the underscore-prefixed functions would indeed be treated as
private so that we could theoretically remove them if they weren't used
anymore (as that underscore should discourage plugin/theme developers to
use it).
>
> A couple notes on the patch:
> - `is_multi_taxonomy()` does not feel like the right name for this
proposed function. `is_multi_author()` is checking to see whether the site
has multiple authors. By extension, `is_multi_taxonomy()` would check to
see whether the site has multiple taxonomies. But this is not right.
`wp_taxonomy_has_multiple_terms( $taxonomy )` seems more semantically
correct.
> - I don't think we need to have the underscore prefix for
`_clear_multi_taxonomy_cache()`. We're moving away from this kind of
naming convention.
>
>
>
>
--
Ticket URL: <https://core.trac.wordpress.org/ticket/37825#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list