Posted by kmonty on November 27, 2009 at 5:34pm
| Project: | Wordpress Import |
| Version: | 6.x-2.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | critical |
| Assigned: | lavamind |
| Status: | closed (fixed) |
Issue Summary
I just ran an import and the categories are imported perfectly however the tags appear as numbers. (See screenshots of the front page and edit node page).
Below is a sample of my xml dump. Any ideas?
<wp:category><wp:category_nicename>sports</wp:category_nicename><wp:category_parent></wp:category_parent><wp:cat_name><![CDATA[Sports]]></wp:cat_name></wp:category>
<wp:category><wp:category_nicename>theater</wp:category_nicename><wp:category_parent></wp:category_parent><wp:cat_name><![CDATA[Theater]]></wp:cat_name></wp:category>
<wp:category><wp:category_nicename>travel</wp:category_nicename><wp:category_parent></wp:category_parent><wp:cat_name><![CDATA[Travel]]></wp:cat_name></wp:category>
<wp:category><wp:category_nicename>uncategorized</wp:category_nicename><wp:category_parent></wp:category_parent><wp:cat_name><![CDATA[Uncategorized]]></wp:cat_name></wp:category>
<wp:category><wp:category_nicename>video</wp:category_nicename><wp:category_parent></wp:category_parent><wp:cat_name><![CDATA[Video]]></wp:cat_name></wp:category>
<wp:tag><wp:tag_slug>eww-i-think-there-is-gum-stuck-to-my-back</wp:tag_slug><wp:tag_name><![CDATA["eww I think there is gum stuck to my back"]]></wp:tag_name></wp:tag>
<wp:tag><wp:tag_slug>okay-thatll-be-a-box-of-condoms-some-strawberries-some-whipped-cream-and-some-catfood</wp:tag_slug><wp:tag_name><![CDATA["Okay that'll be a box of condoms some strawberries some whipped cream and some catfood"]]></wp:tag_name></wp:tag>
<wp:tag><wp:tag_slug>tears</wp:tag_slug><wp:tag_name><![CDATA[#tears]]></wp:tag_name></wp:tag>
<wp:tag><wp:tag_slug>deappropriation-project</wp:tag_slug><wp:tag_name><![CDATA[(de)appropriation project]]></wp:tag_name></wp:tag>
<wp:tag><wp:tag_slug>1-77</wp:tag_slug><wp:tag_name><![CDATA[1.77]]></wp:tag_name></wp:tag>
<wp:tag><wp:tag_slug>100-things-to-try-before-you-die</wp:tag_slug><wp:tag_name><![CDATA[100 Things to Try Before You Die]]></wp:tag_name></wp:tag>
<wp:tag><wp:tag_slug>12-galaxies</wp:tag_slug><wp:tag_name><![CDATA[12 galaxies]]></wp:tag_name></wp:tag>| Attachment | Size |
|---|---|
| node_page.png | 7.09 KB |
| edit_node_form.png | 32.01 KB |
Comments
#1
I've been trying to track down the issue and what I have found so far is this:
1) The script initially imports all the tags correctly
2) When the script trying to import the entries, it does not accurately map the tags to their newly created drupal terms, so it creates new tags as numbers. (see attached taxonomy "list terms" screenshot)
Any ideas?
#2
Found the bug. Function "wordpress_import_process_post_categories_tags()"
When you save the categories (which is not a "tags" vocabulary), the function saved the terms by term ID (which is how Drupal does it when editing a node). However, when you save something that has autocomplete freetagging, Drupal saves the terms by based on the text string, rather than an exploded string of term ids. I had to edit the section of the function that processed the tags to not do the conversion from text to tid:
// Process tagsforeach ($post['tags'] as $tag) {
//$term = $wordpress_import->tags_map[$tag];
if (!empty($tag)) {
$drupal_tags[] = $tag;
}
}
if (!empty($drupal_tags)) {
$taxonomy['tags'][$wordpress_import->tags_vocabulary] = join(',', $drupal_tags);
}
#3
i can confirm the bug. can you create a patch file so i can test your code?
#4
Fixed in 6.x-2.x-dev.
Thanks!
#5
Automatically closed -- issue fixed for 2 weeks with no activity.