Hi Juriix,
Taxonomy hierarchy can be imported when terms are added to a post / post_type by enabling hierachy and setting the hierarchy character https://www.importwp.com/docs/importer/how-to-guides/how-to-import-wordpress-taxonomies-onto-a-post-type/
However your feed:
Kids > Shoes > Walk, Run > Walk
Kids > Shoes > Walk, Run > Run
Kids > T-shirt
Kids > Glasses
Would match the following hierarchy:
- Kids
|- Shoes
| |- Walk
|- T-Shirt
|- Glasses
- Run
|- Walk
|- Run
Would match the following hierarchy (if you changed the term seperator delimiter from a “,” ):
- Kids
|- Shoes
| |- Walk, Run
| | |- Walk
| | |- Run
|- T-Shirt
|- Glasses
Please make sure you are using the latest version 2.4.9 or greater as i have fix some bugs relating to this.
-
This reply was modified 4 years ago by
jcollings.
Thread Starter
juriix
(@juriix)
Hello,
I know that categories can be uploaded via Taxomony, but I don’t know where to enter WP Categories and where to Feed Categories so that they merge when they are different -> mapping.
The categories are different, in the feed the category name is not the same as in WP.
Screen:
View post on imgur.com
E.g. WP Shoes VS Feed Socks
I would imagine that I would put WP category in one row, field and Feed category in the other and then they will be merged when importing. This way I add xx Taxomony and map all the categories. But that’s not how it works, is it?
Thank you
-
This reply was modified 4 years ago by
juriix.
-
This reply was modified 4 years ago by
juriix.
-
This reply was modified 4 years ago by
juriix.
Mapping like you suggest can currently only be achieved by creating your own custom function, and using that custom function to modify the feed category names to match your wp category names.
an example of using a custom function to modify dates, can be seen here: https://www.importwp.com/docs/importer/code-snippets/modifying-dates-using-custom-methods/ , this should give you an idea of how to create and use custom methods.
Thread Starter
juriix
(@juriix)
I can’t handle this, it’s too complicated. I’m not a programmer.
Ok, if you can provide me with a 2 column csv list of Feed Term values, and Wp Term value, i should be able to create you a custom function.
e.g.
Feed Term, WP Term
Feed Socks, WP Shoes
Thread Starter
juriix
(@juriix)
Wait a minute. I’ll add it right here.
Thread Starter
juriix
(@juriix)
I created a table CSV with two columns. If you prepared them for me, it would be great.
Table CSV:
https://easyupload.io/96rs0f
UTF8
delimiter is ,
Hi Juriix,
Sorry it has taken so long to get back to you, but i have been away from the keyboard over the weekend.
Please update import wp to v2.4.10+
Custom method to map your categories, add this to your theme or via a plugin:
function iwpex_juriix_map_categories($input = '')
{
// Feed => WordPress
$map = [
'Boty > Kozačky (Dámské)' => 'Boty > Dámské > Kozačky',
'Boty > Kecky (Dámské)' => 'Boty > Dámské > Kecky',
'Boty > Kecky (Pánské)' => 'Boty > Pánské > Kecky',
'Ponožky > Barevné' => 'Ponožky',
'Ponožky > Bílé' => 'Ponožky',
'Ponožky > Černé' => 'Ponožky',
];
$base_delimiter = apply_filters('iwp/value_delimiter', ',');
$base_delimiter = apply_filters('iwp/taxonomy/value_delimiter', $base_delimiter);
$parts = explode($base_delimiter, $input);
$parts = array_map(function ($item) use ($map) {
return isset($map[$item]) ? $map[$item] : $item;
}, $parts);
return implode($base_delimiter, $parts);
}
Once the code is added, you should be able to update the value in the taxonomy terms field, previously from your screenshot it was {23} , change this to [iwpex_juriix_map_categories("{23}")].
If done correctly, the preview text should update and show the mapped values.