{"id":2603,"date":"2026-10-20T08:35:20","date_gmt":"2026-10-20T07:35:20","guid":{"rendered":"https:\/\/wpgeodirectory.com\/documentation\/article\/csv-import-listing-category-and-subcategory\/"},"modified":"2026-10-20T08:39:39","modified_gmt":"2026-10-20T07:39:39","slug":"csv-import-listing-category-and-subcategory","status":"publish","type":"gd_place","link":"https:\/\/wpgeodirectory.com\/documentation\/article\/how-tos\/csv-import-listing-category-and-subcategory\/","title":{"rendered":"How to import a listing into a category and its subcategory with CSV"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">A GeoDirectory listing can belong to several categories in the same post type, including a parent and its subcategory. In a CSV import you list them all in the <code>post_category<\/code> column.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Set up the CSV<\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Create the categories first at Places &gt; Place Categories, or import them, and note their IDs.<\/li>\n\n\n\n<li>In the <code>post_category<\/code> column, enter the category IDs separated by commas, for example <code>12,34<\/code> for the parent 12 and its subcategory 34.<\/li>\n\n\n\n<li>In the <code>default_category<\/code> column, enter the ID of the main category for the listing. If you leave it empty, the first category in the list is used.<\/li>\n\n\n\n<li>Import the file at GeoDirectory &gt; Settings &gt; Import\/Export &gt; Listings.<\/li>\n\n\n\n<li>Run <em>Term counts<\/em> at GeoDirectory &gt; Status &gt; Tools so the category counts are updated.<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">The easiest way to get the right columns is to export one existing listing and use that file as your template.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Why the parent shows 0<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">A category&#8217;s count only includes listings assigned to that category directly. If you assign a listing to the subcategory only, the subcategory shows 1 and the parent stays at 0. Add the parent&#8217;s ID to <code>post_category<\/code> too if you want it counted there.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">See <a href=\"https:\/\/wpgeodirectory.com\/documentation\/article\/how-tos\/can-i-place-a-listing-in-multiple-categories\/\">Can I Place a Listing in Multiple Categories?<\/a>, <a href=\"https:\/\/wpgeodirectory.com\/documentation\/article\/how-tos\/what-is-the-default-category-field-for\/\">What is the Default Category Field for?<\/a> and <a href=\"https:\/\/wpgeodirectory.com\/documentation\/article\/how-tos\/csv-imports-useful-tips\/\">CSV Imports &#8211; Useful Tips<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A GeoDirectory listing can belong to several categories in the same post type, including a parent and its subcategory. In a CSV import you list them all in the post_category column. Set up the CSV The easiest way to get the right columns is to export one existing listing and use that file as your [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"article\/tags":[],"article\/categories":[211,432],"class_list":["post-2603","gd_place","type-gd_place","status-publish","hentry","gd_placecategory-tips-tricks-more","gd_placecategory-how-tos"],"_links":{"self":[{"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article\/2603","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article"}],"about":[{"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/types\/gd_place"}],"author":[{"embeddable":true,"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/comments?post=2603"}],"version-history":[{"count":1,"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article\/2603\/revisions"}],"predecessor-version":[{"id":2786,"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article\/2603\/revisions\/2786"}],"wp:attachment":[{"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/media?parent=2603"}],"wp:term":[{"taxonomy":"gd_place_tags","embeddable":true,"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article\/tags?post=2603"},{"taxonomy":"gd_placecategory","embeddable":true,"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article\/categories?post=2603"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}