Support » Plugin: Really Simple CSV Importer » how to format nested taxonomies,

  • Resolved arsenalemusica

    (@arsenalemusica)


    I hope the Author replies to this.
    I have the same problem as this other user, my tax_{custom_name} are imported broken because the commas are interpreted as fields separator.
    I even quoted the cell, but nothing.

    How should I format this type of text?
    parent1>child1|parent2>child2|parent3>child3a, child3b

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hey @arsenalemusica

    This plugin looks unsupported but I guess this is as useful for you as it is for me. I recommend you to edit the plugin and rename it, this will prevent any possible update.

    Then, in file rs-csv-importer.php after the comment [// (string, comma separated) slug of post categories] you can edit the post_category column data. I have added a simple snippet that accepts a parent > child structure.

    
    $inserted_categories = array();
    $categories = explode(', ', $post_category);
    foreach ($categories as $key => $category) {
    	$_categories = preg_split("/ > +/", $category);
    	$cat_id = wp_create_category($_categories[0]);
    	$inserted_categories[] = $cat_id;
    
    	if (isset($_categories[1])) {
    		$inserted_categories[] = wp_create_category($_categories[1], $cat_id);
    	}
    }
    $post['post_category'] = $inserted_categories;
    

    Hope it helps!

    Regards.

    oh, thank you very much for your support.
    I have actually assigned my categories manually (it was tedious, as I have over 10k records) so I’m fine for the moment but I will safely keep your code in case I should make some new imports. 🙂

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘how to format nested taxonomies,’ is closed to new replies.