WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 3 years ago

#14306 closed defect (bug) (fixed)

Custom Taxonomies not associated to Custom Post Type on Export

Reported by: jeffikus Owned by:
Milestone: 3.1 Priority: normal
Severity: normal Version: 3.0
Component: Export Keywords: has-patch early
Focuses: Cc:

Description

When I export my blogs data including all the Custom Post Types and the associated Custom Taxonomies, and I import on the other wordpress blog, the Custom Taxonomies are not assigned back to the Custom Post Type and the hierarchy of the custom taxonomies have been lost (although they are imported).

I have read http://wordpress.org/support/topic/412612?replies=2 and no one has responded to this. I have specified 'can_export' => true in the register_post_type() declaration. Also, this has apparently been fixed in http://core.trac.wordpress.org/ticket/12180 yet I am having the same issue.

I have tried other taxonomy plugins, including GD Custom Posts And Taxonomies Tools and they all give the same issue.

If you want more info I can send you the code/data.

Attachments (1)

export.patch (669 bytes) - added by ajferg 4 years ago.

Download all attachments as: .zip

Change History (8)

comment:1 ajferg4 years ago

  • Cc ajferg added

Hi Jeffikus,

I've also had this problem. I'm not sure how to submit a patch, exactly, but I think I've found a fix.

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);

See if that fixes your issue?

comment:2 nacin4 years ago

  • Keywords needs-refresh added; export import custom post type custom taxonomy removed
  • Milestone changed from Awaiting Review to 3.1

#12180 (related) closed again.

For patches, see http://core.trac.wordpress.org/#HowtoSubmitPatches.

ajferg4 years ago

comment:3 ajferg4 years ago

Hope I did that right! Can anyone confirm?

comment:4 nacin4 years ago

  • Keywords has-patch early added; needs-refresh removed

Looks good.

comment:5 epicalex4 years ago

  • Resolution set to fixed
  • Status changed from new to closed

Not sure what to update on here, but I can confirm this fix works.

comment:6 nacin4 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

We only close tickets once they have been committed to core.

comment:7 nacin3 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

(In [15961]) Importer and exporter overhaul, mega props duck.

Exporter overhaul:

  • Add author information to export
  • Greater usage of slug identifiers
  • Don't export auto-drafts, spam comments, or edit lock/last meta keys
  • Inline documentation improvements
  • Remove filtering for now (@todo)
  • Bump WXR version to 1.1, but remain back compat in the importer

Importer overhaul (http://plugins.trac.wordpress.org/changeset/304249):

  • Use an XML parser where available (SimpleXML, XML Parser)
  • Proper import support for navigation menus
  • Many bug fixes, specifically improvements to category and custom taxonomy handling
  • Better author/user mapping

Fixes #5447 #5460 #7400 #7973 #8471 #9237 #10319 #11118 #11144 #11354 #11574 #12685 #13364 #13394 #13453 #13454 #13627 #14306 #14442 #14524 #14750 #15055 #15091 #15108.

See #15197.

Note: See TracTickets for help on using tickets.