[wp-trac] [WordPress Trac] #21378: get_the_category doesn't work for custom post types with custom taxonomies
WordPress Trac
noreply at wordpress.org
Tue Mar 4 12:20:57 UTC 2014
#21378: get_the_category doesn't work for custom post types with custom taxonomies
-------------------------+----------------------
Reporter: tcattitude | Owner:
Type: enhancement | Status: closed
Priority: normal | Milestone:
Component: Taxonomy | Version: 3.4.1
Severity: normal | Resolution: invalid
Keywords: | Focuses:
-------------------------+----------------------
Changes (by SergeyBiryukov):
* status: reopened => closed
* resolution: => invalid
Comment:
Replying to [comment:6 leroy-b]:
> what is a possible resolution, if what I want is exactly the standard
'category' to be listed in a custom post type?
Use
[http://codex.wordpress.org/Function_Reference/register_taxonomy_for_object_type
register_taxonomy_for_object_type()] or the `taxonomies` argument of
[http://codex.wordpress.org/Function_Reference/register_post_type
register_post_type()] to add the default `category` taxonomy (or a custom
taxonomy) to a custom post type.
Use [https://codex.wordpress.org/Function_Reference/get_the_category
get_the_category()] retrieve categories assigned to the post (from the
default `category` taxonomy).
Use [https://codex.wordpress.org/Function_Reference/get_the_terms
get_the_terms()] to retrieve other terms assigned to the post (from custom
taxonomies).
Please try the support forums if you have more questions:
http://wordpress.org/support/.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/21378#comment:7>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list