[wp-trac] [WordPress Trac] #12180: Custom taxonomies for custom post types exported but not tied to posts

WordPress Trac wp-trac at lists.automattic.com
Wed Sep 1 03:47:17 UTC 2010


#12180: Custom taxonomies for custom post types exported but not tied to posts
--------------------------+-------------------------------------------------
 Reporter:  greenshady    |        Owner:          
     Type:  defect (bug)  |       Status:  reopened
 Priority:  normal        |    Milestone:  3.0     
Component:  Export        |      Version:  3.0.1   
 Severity:  normal        |   Resolution:          
 Keywords:                |  
--------------------------+-------------------------------------------------
Changes (by ajferg):

  * status:  closed => reopened
  * version:  3.0 => 3.0.1
  * resolution:  fixed =>


Comment:

 This problem is still occurring in 3.0.1

 I have custom post types (product) and custom non-hierarchical taxonomy
 (category).  When I export, both Products and Categories are exported, but
 the products have no category association. I've checked the generated XML
 file, and taxonomy information is present for Posts, but not my custom
 Product post-type.

 I'm not sure exactly how to submit a patch, but I think I managed to fix
 the issue in my local copy.

 In /wp-admin/includes/export.php, there's a function wxr_post_taxonomy()
 about line 253

 Replace this:
         $taxonomies = get_object_taxonomies( 'post' );
         $terms = wp_get_post_terms( $post->ID, $taxonomies );

 With this:
         $taxonomies = get_object_taxonomies( $post->post_type );
         $terms = wp_get_object_terms($post->ID, $taxonomies);

 The original code limits taxonomies to those associated with the 'post'
 post-type.  This fix seeks taxonomies associated with whatever post-type
 this object may be.

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


More information about the wp-trac mailing list