[wp-trac] [WordPress Trac] #9227: in get_the_category_list(), filter categories before constructing list
WordPress Trac
noreply at wordpress.org
Sun Sep 27 02:14:18 UTC 2015
#9227: in get_the_category_list(), filter categories before constructing list
-------------------------+-----------------------------
Reporter: KevinB | Owner: wonderboymusic
Type: enhancement | Status: assigned
Priority: normal | Milestone: 4.4
Component: Taxonomy | Version: 2.8
Severity: normal | Resolution:
Keywords: has-patch | Focuses: template
-------------------------+-----------------------------
Changes (by boonebgorges):
* keywords: has-patch 2nd-opinion => has-patch
* milestone: Future Release => 4.4
Comment:
Replying to [comment:22 SergeyBiryukov]:
> 1. In [attachment:9227.4.diff], `$categories` should be an array rather
than array|bool, because [source:tags/3.9.1/src/wp-includes/category-
template.php#L65 get_the_category()] always returns an array. The docs
need to be adjusted as well.
> 2. [source:tags/3.9.1/src/wp-includes/category-template.php#L85
get_the_categories] filter was added in [16332]. Is there a use case that
cannot be achieved using that filter? You can conditionally apply it on
front-end as needed. We don't pass the post ID there, perhaps we should do
that instead of introducing a new filter.
`get_the_category()` is also used in `get_permalink()`. This is a very
different context from using `get_the_category()` to get categories for
display. So I'd say that it's worth having a separate filter, though
passing the post ID to 'get_the_categories' is also a dynamite idea.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/9227#comment:25>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list