Make WordPress Core

Opened 10 years ago

Last modified 6 years ago

#28297 new defect (bug)

Losing custom nav menu data while importing / exporting XML

Reported by: isharis's profile isharis Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 3.9.1
Component: Import Keywords: needs-patch needs-testing
Focuses: Cc:

Description

I have added few fields to the menu for mega menu functionality: https://gist.github.com/mharis/150f43e09adf72d7d0bb

This works fine and when I tried to export the site content which did have all the navigation items and the custom fields and its values in the XML file (https://www.dropbox.com/s/7i2l3x2mvpgup58/xml-test.xml) which is perfectly fine.

The problem happens when importing, only the keys are imported for the custom navigation menu fields and not its value. The values are stripped even through the data seems correct in the XML file.

Any thoughts over it?

Attachments (1)

xml-test.xml (15.3 KB) - added by isharis 10 years ago.

Download all attachments as: .zip

Change History (4)

@isharis
10 years ago

#1 in reply to: ↑ description @isharis
10 years ago

Replying to isharis:

I have added few fields to the menu for mega menu functionality which works fine: https://gist.github.com/mharis/150f43e09adf72d7d0bb

I tried to export my site content and the exported XML file did have all the navigation items and custom menu fields with their correct values (https://www.dropbox.com/s/7i2l3x2mvpgup58/xml-test.xml).

The problem happens when importing the XML file, only the keys are imported from the custom navigation menu fields and not the values. The values are stripped even though the data seems correct in the XML file.

Any thoughts over it?

Fixed . Sorry about the typos.

Last edited 10 years ago by isharis (previous) (diff)

#2 @chriscct7
8 years ago

  • Keywords needs-patch needs-testing added

#3 @QantumThemes
6 years ago

I found and fixed the issue in wordpress-importer.php, actually using our patched library for demo site importing in our plugins, which isn't good as it will break if any core update will occur. So i'm sharing the fix in case you want to provide an official upgrade of the file.

<?php
${$meta['key']} = $meta['value'];

and NOT

<?php
$$meta['key'] = $meta['value'];
Last edited 6 years ago by QantumThemes (previous) (diff)
Note: See TracTickets for help on using tickets.