Title: Categories (syntax)
Last modified: September 5, 2024

---

# Categories (syntax)

 *  Resolved [kebikec](https://wordpress.org/support/users/kebikec/)
 * (@kebikec)
 * [1 year, 9 months ago](https://wordpress.org/support/topic/categories-syntax/)
 * Hello,
 * I have a category structure with 4 levels in my posts.
   (some posts stay at level
   2 or 3)
 * As you can see from the attached photo, I tried to write the category structure
   in several formats, but I could not figure out how to write it.
   [https://imgtr.ee/images/2024/09/05/e04958c6687134c9e15f9832c538ab44.png](https://imgtr.ee/images/2024/09/05/e04958c6687134c9e15f9832c538ab44.png)
 * {Categories}{Categories-2}{Categories-3}{Categories-4}
   {Categories}/{Categories-
   2}/{Categories-3}/{Categories-4}
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fcategories-syntax%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 6 replies - 1 through 6 (of 6 total)

 *  Thread Starter [kebikec](https://wordpress.org/support/users/kebikec/)
 * (@kebikec)
 * [1 year, 9 months ago](https://wordpress.org/support/topic/categories-syntax/#post-17996897)
 * let me answer my own question 🙂
 * {Categories}**>**{Categories-2}**>**{Categories-3}**>**{Categories-4}
   it’s supposed
   to be like this.
 * In my test, I only used a data with 2 levels full.
   {Categories-2} came selected.
   But I want **all** filled levels to be selected.How can I write this?(I looked
   at the documentation and there is nothing)
 *  Plugin Author [Smackcoders Inc.,](https://wordpress.org/support/users/smackcoders/)
 * (@smackcoders)
 * [1 year, 9 months ago](https://wordpress.org/support/topic/categories-syntax/#post-17998926)
 * Hi [@kebikec](https://wordpress.org/support/users/kebikec/),
 * Thank you for your patience! For setting up your category structure with multiple
   levels, you should use the following format:
 * `<post_category>parent,parent>child,child>grand-child,Uncategorized</post_category
   >`
 * In this format, each level is separated by a `>`, and you list multiple categories
   separated by commas.
 * For example, if you have categories like:
    - Parent
    - Child
    - Grand-child
    - Uncategorized
 * You would structure it as shown. This should allow you to properly select and
   import all levels of categories.
 * ![](https://wordpress.org/671be13b-3790-4244-8fd4-c79d58f93569)
 * To see how it works, you can refer to this sample XML file: [https://drive.google.com/file/d/1l6ICVESCEMaMKF7HMeFmMtcyuuEYvXj8/view?usp=sharing](https://drive.google.com/file/d/1l6ICVESCEMaMKF7HMeFmMtcyuuEYvXj8/view?usp=sharing)
 * Please let me know if you need further assistance!
 *  [Anthony](https://wordpress.org/support/users/hcmobilemedia/)
 * (@hcmobilemedia)
 * [1 year, 9 months ago](https://wordpress.org/support/topic/categories-syntax/#post-18006617)
 * I have a question along the same lines, only with importing a .csv file rather
   than XML.
 * I have a Parent>Child>Grand-child category structure. To keep it clean on the
   front-end, I only select the Grand-child category, not the Child or Parent. How
   would I enter my category into the .csv in order to replicate this in a bulk 
   import, where only the Grand-child is selected? When I enter Parent>Child>Grand-
   child into the .csv all three are selected in the post.
 *  Plugin Author [Smackcoders Inc.,](https://wordpress.org/support/users/smackcoders/)
 * (@smackcoders)
 * [1 year, 9 months ago](https://wordpress.org/support/topic/categories-syntax/#post-18008133)
 * To achieve the desired result, please enter only the Grand-child category name
   in the ‘post_category’ field of your import file. This ensures that only the 
   Grand-child category is selected during the bulk import, keeping the Parent and
   Child categories unselected.
 *  [Anthony](https://wordpress.org/support/users/hcmobilemedia/)
 * (@hcmobilemedia)
 * [1 year, 9 months ago](https://wordpress.org/support/topic/categories-syntax/#post-18008952)
 * Ahh okay. Thank you. That worked. For some reason I didn’t think it would recognize
   the existing category or the fact that it was a child category, but it properly
   detected existing categories and their grand-child or child level.
 *  Plugin Author [Smackcoders Inc.,](https://wordpress.org/support/users/smackcoders/)
 * (@smackcoders)
 * [1 year, 9 months ago](https://wordpress.org/support/topic/categories-syntax/#post-18012066)
 * Glad to hear it worked for you! 😊 If you need any more help, feel free to ask.

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Categories (syntax)’ is closed to new replies.

 * ![](https://ps.w.org/wp-ultimate-csv-importer/assets/icon.svg?rev=3131703)
 * [WP Ultimate CSV Importer – WordPress Import & Export for CSV, XML & Excel](https://wordpress.org/plugins/wp-ultimate-csv-importer/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-ultimate-csv-importer/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-ultimate-csv-importer/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-ultimate-csv-importer/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-ultimate-csv-importer/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-ultimate-csv-importer/reviews/)

## Tags

 * [categories](https://wordpress.org/support/topic-tag/categories/)
 * [csv](https://wordpress.org/support/topic-tag/csv/)
 * [Import](https://wordpress.org/support/topic-tag/import/)

 * 6 replies
 * 3 participants
 * Last reply from: [Smackcoders Inc.,](https://wordpress.org/support/users/smackcoders/)
 * Last activity: [1 year, 9 months ago](https://wordpress.org/support/topic/categories-syntax/#post-18012066)
 * Status: resolved