{"id":3282514,"date":"2012-12-17T03:25:02","date_gmt":"2012-12-17T03:25:02","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/bulk-importing-categories-into-wp\/"},"modified":"2016-08-20T19:08:05","modified_gmt":"2016-08-20T19:08:05","slug":"bulk-importing-categories-into-wp","status":"closed","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/bulk-importing-categories-into-wp\/","title":{"rendered":"Bulk importing categories into WP"},"content":{"rendered":"<p>I am migrating my website from another CMS to WP.<\/p>\n<p>I have a csv file with more than 10,000 rows with 6 columns &#8211; continent, continent_id, country, country_id, city, city_id.<br \/>\nI wish to import these as nested categories in WordPress with the category name as slugs. There will be 3 levels (continent -&gt; country -&gt; city)<\/p>\n<p>I need a solution which would help me do this efficiently &#8211; it can either be a plugin or a php script that I run once to import the data. <\/p>\n<p>If I am not wrong a custom taxonomy would solve it, but I&#8217;m not too advanced at WP and not sure how to build a solution myself.<\/p>\n<p>The challenges are:<br \/>\n1) Some city and country names are the same (e.g., country-&gt; Hong Kong, city-&gt; Hong Kong). WordPress does not allow duplicate slugs. In this case it is OK to add a 2 behind the duplicate (i.e., city) slug to differentiate it from the country slug<br \/>\n2) I want the continent, country and city IDs to be preserved somehow as as I need to bulk import posts into WP later using the IDs as identifiers linking the posts to their respective categories.<\/p>\n<p>Any advice or help would be much appreciated!<\/p>\n","protected":false},"template":"","class_list":["post-3282514","topic","type-topic","status-closed","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/3282514","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/3282514\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=3282514"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}