[wp-trac] [WordPress Trac] #18636: is_tax() returns false when is_category() or is_tag() returns true
WordPress Trac
noreply at wordpress.org
Tue Dec 4 23:21:08 UTC 2012
#18636: is_tax() returns false when is_category() or is_tag() returns true
--------------------------+----------------------
Reporter: Viper007Bond | Owner:
Type: defect (bug) | Status: closed
Priority: normal | Milestone:
Component: Taxonomy | Version: 3.3
Severity: normal | Resolution: wontfix
Keywords: has-patch |
--------------------------+----------------------
Comment (by ericmann):
Replying to [comment:9 nacin]:
> Not to be dismissive, but I would start by reading comments 5, 6, and 7.
No, I read those ... and I still don't see this as an issue.
>This kind of construct absolutely appears in core in some manner in some
places. Indeed, this would break the template loader, as `is_tax()` gets
called before either of the others.
As Viper pointed out, swapping the order of calls there would alleviate
the issue in core.
A quick search through core shows that it's already used in the right
order in most places anyway. The only place I can see it breaking is the
template loader:
{{{
...
if ( is_404() && $template = get_404_template()
) :
elseif ( is_search() && $template = get_search_template()
) :
elseif ( is_tax() && $template = get_taxonomy_template()
) :
elseif ( is_front_page() && $template = get_front_page_template()
) :
elseif ( is_home() && $template = get_home_template()
) :
elseif ( is_attachment() && $template = get_attachment_template()
) :
remove_filter('the_content', 'prepend_attachment');
elseif ( is_single() && $template = get_single_template()
) :
elseif ( is_page() && $template = get_page_template()
) :
elseif ( is_category() && $template = get_category_template()
) :
elseif ( is_tag() && $template = get_tag_template()
) :
...
}}}
And that can be fixed by reordering the conditional.
>But how many plugins and themes who were doing it right will suddenly be
doing it wrong?
I would argue that they weren't "doing it right" in the first place. I
could (and would) make the argument that the fact that `is_tax()` behaves
differently for tags and categories at all means that it's been doing it
wrong from the beginning.
It's misleading to claim custom taxonomies are on-par with tags and
categories when there's functionality like this in core. It's not clear
from the documentation that these issues will come up (which can be
addressed if we're never going to change it), and it makes new code harder
to follow when you have flexible logic for all but 2 taxonomies and hard-
coded logic to handle them specifically.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/18636#comment:11>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list