[wp-trac] [WordPress Trac] #37368: get_object_taxonomies() ignores output type argument for attachments

WordPress Trac noreply at wordpress.org
Sat Aug 20 17:48:23 UTC 2016


#37368: get_object_taxonomies() ignores output type argument for attachments
--------------------------------------+---------------------
 Reporter:  Rarst                     |       Owner:
     Type:  defect (bug)              |      Status:  closed
 Priority:  normal                    |   Milestone:  4.7
Component:  Taxonomy                  |     Version:  3.0
 Severity:  normal                    |  Resolution:  fixed
 Keywords:  good-first-bug has-patch  |     Focuses:
--------------------------------------+---------------------
Changes (by boonebgorges):

 * status:  reopened => closed
 * resolution:   => fixed


Comment:

 @deeptiboddapati Thank you for the detailed comments. Some responses:

 > This circular dependency should be removed

 Fetching taxonomies for an attachment is special, because it's possible to
 register taxonomies for specific attachment types: `attachment:image`,
 `attachment:image/jpeg`, and so forth. What `get_attachment_taxonomies()`
 does (this is the "unneeded text parsing" you mention) is to assemble a
 list of all taxonomy object types that match a given attachment. These
 types are then passed to `get_object_taxonomies()`, which is a general
 function for fetching taxonomies by object types. The fact that you can
 pass an 'attachment' to `get_object_taxonomies()` and have it work is
 merely a developer convenience. So the functions play different roles, and
 the "circular dependency" is not a bug but a feature that allows us to
 minimize the amount of duplicated code.

 You did some research into the various parameter values and return values
 of `get_object_taxonomies()`. I'm not sure I understand the chart
 completely, but it does look like you've found a couple of bugs related to
 PHP notices and mixed post types. These deserve one or two separate bug
 tickets. You also point out that the documentation is not clear on what
 the `$object` parameter accepts. If you have a suggestion about how this
 could be worded better, please do open a ticket with a suggestion.

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


More information about the wp-trac mailing list