Make WordPress Core

Opened 9 years ago

Closed 9 years ago

Last modified 6 years ago

#3840 closed defect (bug) (duplicate)

WXR imported pages dissapear

Reported by: sunburntkamel Owned by: technosailor
Milestone: Priority: low
Severity: normal Version: 2.1
Component: General Keywords: WXR import export pages CMS
Focuses: Cc:


when importing via a wordpress-generated export file (XML file), any pages that have a value for post_parent dissapear from the dashboard ( Manage > Pages ), and must be editted in PHPMyAdmin or similar to assign them a new post_parent value that reflects the new page ID's.

Attachments (1)

import.php.diff (1.8 KB) - added by technosailor 9 years ago.
Reupped. Diff on wrong file

Download all attachments as: .zip

Change History (11)

#1 @sunburntkamel
9 years ago

export environment: IIS, with MySQL 4.1.21-community-nt
PHP Version 4.3.1 CGI/FastCGI

import environment (XAMPP): Apache/2.2.2 (Win32), MySQL - 5.0.21-community-nt, PHP/5.1.4

#2 @jschwanz
9 years ago

I've experienced the same issue. Both environments are LAMP.

#3 @foolswisdom
9 years ago

  • Milestone changed from 2.1.3 to 2.2

#4 @technosailor
9 years ago

  • Owner changed from anonymous to technosailor

#5 @technosailor
9 years ago

Diff screwed. New one coming with explanation.

9 years ago

Reupped. Diff on wrong file

#6 @technosailor
9 years ago

This patch simply takes source blog ID numbers and places them in a lookup array with new post IDs. This way, we can refer to the the lookup array for proper post_parent associations.

Up for suggestions on a more elegant solution that doesn't query mysql.

#7 @takayukister
9 years ago

Hi technosailor,

I checked this patch and found a defect. In case pretty permalink is used, it can generate incorrect guid. For example, when a page "Child" has a parent page "Parent", the child's guid should be:


But applied this patch, it'll be:


This is because the original importing code uses wp_insert_post() to generate new posts, it needs the post name of the parent page to generate child's guid. So I think it would be safe to process parent first. (I created another patch. http://trac.wordpress.org/ticket/4025 If two places are reporting the same issue, should we merge?)

#8 @technosailor
9 years ago


I'm happy if your patch is used. I think the key thing is that _a_ patch gets applied relatively soon. In addition, there are quite a few WXR bugs in trac. Maybe you want to expand your patch to address those issues as well and we can get one of the guys to commit and kill multiple birds with one stone.

Thanks for the feedback.

#9 @ryan
9 years ago

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

Duping against 4025.

#10 @Nazgul
9 years ago

  • Milestone 2.2 deleted
Note: See TracTickets for help on using tickets.