[wp-trac] [WordPress Trac] #30833: Post type object does not always have taxonomies populated correctly.

WordPress Trac noreply at wordpress.org
Wed Dec 24 06:45:53 UTC 2014


#30833: Post type object does not always have taxonomies populated correctly.
-------------------------------------------+------------------------------
 Reporter:  desrosj                        |       Owner:
     Type:  defect (bug)                   |      Status:  new
 Priority:  normal                         |   Milestone:  Awaiting Review
Component:  Taxonomy                       |     Version:  3.0
 Severity:  normal                         |  Resolution:
 Keywords:  has-patch needs-testing close  |     Focuses:
-------------------------------------------+------------------------------
Changes (by nacin):

 * keywords:  has-patch needs-testing => has-patch needs-testing close
 * version:  4.1 => 3.0


Comment:

 The 'taxonomies' property is actually only for registration. We probably
 should unset it after we call register_taxonomy_for_object_type()
 internally.

 Post types associated with a taxonomy are stored within the taxonomy
 object. You can get them by doing this:
 {{{
 $object_types = get_taxonomy( $taxonomy )->object_types;
 // object types could include 'user', 'link', or something arbitrary
 $object_types = array_filter( $object_types, 'post_type_exists' );
 }}}

 Eventually, post type objects and taxonomy objects will be proper objects
 (no timeline for this — we have a long way to go before this makes sense
 and the picture is clear), at which point helper methods may make this
 easier, and would allow for live-updating at any given time.

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


More information about the wp-trac mailing list