humanmade / WordPress-Importer

In-development rewrite of the WordPress (WXR) Importer
Other
358 stars 63 forks source link

upon import term->parent is not correct #121

Open pbiron opened 7 years ago

pbiron commented 7 years ago

Non-empty <wp:category_parent> and <wp:term_parent> elements are not processed correctly. As a result, all imported terms have term->parent == 0.

pbiron commented 7 years ago

I've got a fix for this but can't yet submit a PR for it until the Simple namespace-aware parsing PR is merged because the fix for this relies on the unit tests I added in that PR.

dcavins commented 7 years ago

I too have encountered this problem and have added a PR that addresses the underlying issue: https://github.com/humanmade/WordPress-Importer/pull/129

@pbiron Please take it for a test drive and see if it fixes the issue for you.

pbiron commented 7 years ago

@dcavins Glancing thru the changes in your PR it looks like your fix is more complete than mine (one of these days I'll wrap my head around the $this->mapping and post_process_xyz() code in this plugin).

I'll give yours a try when I get a chance and report back.

dcavins commented 7 years ago

Thanks @pbiron. I had to do some digging to understand what's going on with the term import, too. Basically, the $exists array is meant to be a cache to avoid a million individual MySQL queries for terms. I opened a new issue about some thoughts on the exists and mapping arrays here: https://github.com/humanmade/WordPress-Importer/issues/130

pbiron commented 7 years ago

@dcavins I just had a chance to review your PR and it passed all the tests I wrote for it. So, hopefully, it'll get merged soon.

dcavins commented 7 years ago

@pbiron Thanks for testing this PR out. It's great to have another pair of eyes look at it, and I love it when somebody's got tests to apply. 👍