Title: categories shortcode
Last modified: June 21, 2024

---

# categories shortcode

 *  Resolved [kitka](https://wordpress.org/support/users/kitka/)
 * (@kitka)
 * [1 year, 11 months ago](https://wordpress.org/support/topic/categories-shortcode-2/)
 * Hi, on this page I display a list of categories (which are countries). I use 
   this shortcode [categories parent=”0″ orderby=category show_count=true title_li
   =””] which is generated by a plugin List Categories.
 * My question is how to modify this shortcode so that child categories are excluded.
   I am guessing it is within this array?
 * $atts = shortcode_atts( array( ‘child_of’ => 0, ‘current_category’ => 0, ‘depth’
   => 0, ‘echo’ => 1, ‘exclude’ => ”, ‘exclude_tree’ => ”, ‘feed’ => ”, ‘feed_image’
   => ”, ‘feed_type’ => ”, ‘hide_empty’ => 1, ‘hide_title_if_empty’ => false, ‘hierarchical’
   => 1, ‘include’ => ”, ‘number’ => null, ‘order’ => ‘ASC’, ‘orderby’ => ‘name’,‘
   pad_counts’ => 0, ‘show_count’ => 0, ‘show_option_all’ => ”, ‘show_option_none’
   => __( ‘No categories’ ), ‘style’ => ‘list’, ‘taxonomy’ => ‘category’, ‘title_li’
   => __( ‘Categories’ ), ‘use_desc_for_title’ => 1, ‘walker’ => null, ), $atts );
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fcategories-shortcode-2%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

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

 *  [Vishal Patel](https://wordpress.org/support/users/vishaliihglobal/)
 * (@vishaliihglobal)
 * [1 year, 11 months ago](https://wordpress.org/support/topic/categories-shortcode-2/#post-17840287)
 *     ```wp-block-code
       Hello @kitka please try to this code & shortcode$atts = shortcode_atts( array('child_of' => 0,'current_category' => 0,'depth' => 1, // Set depth to 1 to exclude child categories'echo' => 1,'exclude' => '','exclude_tree' => '','feed' => '','feed_image' => '','feed_type' => '','hide_empty' => 1,'hide_title_if_empty' => false,'hierarchical' => 1,'include' => '','number' => null,'order' => 'ASC','orderby' => 'name','pad_counts' => 0,'show_count' => 0,'show_option_all' => '','show_option_none' => ( 'No categories' ), 'style' => 'list','taxonomy' => 'category','title_li' => ( 'Categories' ),'use_desc_for_title' => 1,'walker' => null,), $atts );Shortcode here [categories parent="0" orderby="category" show_count="true" title_li="" depth="1"]
       ```
   
 *  Thread Starter [kitka](https://wordpress.org/support/users/kitka/)
 * (@kitka)
 * [1 year, 11 months ago](https://wordpress.org/support/topic/categories-shortcode-2/#post-17840879)
 * Thank you Vishal! Works!

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

The topic ‘categories shortcode’ is closed to new replies.

## Tags

 * [shortcode](https://wordpress.org/support/topic-tag/shortcode/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 2 participants
 * Last reply from: [kitka](https://wordpress.org/support/users/kitka/)
 * Last activity: [1 year, 11 months ago](https://wordpress.org/support/topic/categories-shortcode-2/#post-17840879)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
