[wp-trac] [WordPress Trac] #14370: Custom Taxonomies tagging Attachments

WordPress Trac wp-trac at lists.automattic.com
Mon Jul 26 23:54:50 UTC 2010


#14370: Custom Taxonomies tagging Attachments
--------------------------+-------------------------------------------------
 Reporter:  thee17        |       Owner:                 
     Type:  defect (bug)  |      Status:  new            
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Taxonomy      |     Version:  3.0            
 Severity:  major         |    Keywords:  dev-feedback   
--------------------------+-------------------------------------------------

Comment(by thee17):

 Okay to begin with you create the tax

 {{{
       register_taxonomy(
                'people',
                array('attachment:image', 'attachment:video',
 'attachment:audio'),
                 array(
                         'label' => __('People'),
                         'template' => __('People: %l.'),
                         'helps' => __('Separate people with commas.'),
                         'show_ui' => true,
                         'sort' => true,
                         'args' => array('orderby' => 'term_order'),
                         'rewrite' => array('slug' => 'person'),
                )
        );
 }}}

 As you can see it is a tax that is only linked to an attachment post_type
 of images, video and audio.

 From here you can tag the attachments from the Media admin (a People:
 field appears) or Matt's Community Tags plugin.

 At this point the taxonomy page reveals no results. If you assign the Tax
 to pages it works as expected, but only pages show. Custom Post Types are
 tested to work as well with a 'publish' post_status.

 Attachment post_type by their nature have an 'inherit' post status that is
 not set to 'public', if 'inherit' is defined to be a public status than
 images appear and page properly.

 The following code will override in the theme template but will not page.

 {{{
 <?php global $wp_query;
 query_posts(
         array_merge(
                 array('post_status' => publish,),
                 $wp_query->query
         )
 );
  ?>
 }}}

 Therefore attachment is not inheriting its status from it's attached
 post_type properly. This used to work in 2.9.2 but something changed in
 3.0.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/14370#comment:6>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list