To get direct descendants (i.e. children only) of the category, you need to make use of the parent
parameter in get_categories()
The reason why you might not see your other category is that it does not have any posts assigned to it. To display empty categories, you need to set the hide_empty
parameter to 0
Otherwise I do not see any problems with your code. You should also turn on debugging to check if you maybe have some kind of error if the above does not work
Related Posts:
- List all subcategories from category
- Get the children of the parent category
- How to remove the term “category” from category pagination?
- Force WordPress to Show Pages Instead of Category
- How do I get the category URL from get_the_category?
- Display all posts in category, with specific tag posts at top
- How to Set an Individual Homepage for Each User?
- Is there a way to remove categories in bulk?
- Is it possible to put next and previous category links?
- Custom category template pagination problem
- Deleting All tags except categories Wp database
- Getting category before saving post
- How do I change the sql query for wp_get_archive()
- Woocommerce – Get product category 2nd level category
- Hide post meta data on a specific category
- New categories are now going to 404s
- How to put enctype=”multipart/form-data” in categories form?
- How can I get an tag to wrap each ancestor that gets outputted in this condition?
- How to prevent empty category to list content of sub categories?
- “Reversable” and “Re-useable” Subcategories (or other taxonomic structure)
- What is the advantage of using header-catname.php over is_category(‘catname’);?
- Use a wordpress page to display a certain category
- Insert Into Sub-child Menu
- Change the category of all posts in it
- Search Posts / Pages with multiple options?
- Creating gallery with taxonomy images plugin?
- Full text articles in the rss feed (i.e. without the more tag)
- How to hide some categories in category list under post in wordpress?
- Solution for ascending order in a category
- Why do my categories redirect?
- Restoring default article pagination on archives – Removing custom limits
- Read GET parameters in APACHE Mod Rewrite rules for WordPress categories in Posts
- How to categorize posts under Category 1 and Category 2 which are separate lists of categories, and display them as separate lists in widgets
- how to get child category title and image
- How to display all the categories a post is in
- Why don’t posts show up in my categories on the frontend?
- Creating Category Specific menus
- Should I use “Categories ” or “Pages” for a WordPress Static Site (A non blog site)?
- How do I query_posts in cat=1 AND not in cat=2
- How to do some action weekly?
- Display single category name in woocommerce loop
- How to allow Category Title to use tags?
- Functions.php: Exclude Category from “Blog”
- Use premade array as categories in wp_query?
- How do I get category and page ID’s?
- Category images are not displaying in WordPress
- Some categories missing on wp-admin/edit-tags.php?taxonomy=category
- Show child taxonomies (that have posts) of the current parent taxonomy
- Multiple selection for wordpress widget
- Get next post in same category not working WP 4.7.4
- How do you use the featured image of the most recent post in a category as the background image
- How do I retrieve the category ID (ugly permalinks) in my sub-navigation menu?
- function query_posts disabling current_page_menu class
- Using if statement in index.php instead of creating separate template files
- How to only show parent categories in sidebar
- Change RSS format for specific categories
- I need to exclude from a query a category and a few custom taxonomies
- Displaying a custom field in Category Archives
- List post only under the category, exclude child category content
- Custom Fields Value As Taxonomy
- Detect category choice for posts with multiple categories
- wp_insert_link not working
- Redirect Problems with Archive Page and GET variables
- Different size video display for category page (smaller) & detail page (larger)
- Adding tinymce to Custom Field boxes on Category edit page
- wp_list_categories : how do I sort by ID when IDs are not sequential
- Showing different posts on category pages
- add current-cat class to single post page
- How to exclude certain categories showing in Gutenberg?
- Problem with pagination block in Gutenberg
- How to redirect to category page if page does not exists?
- Sort categories by custom field in WordPress admin
- Display the articles of a category by role
- Remove “Category:” from Post meta
- Related to genre and category
- Get permalink to latest post in category
- How to load terms of a custom taxonomy of a product in woocommerce cart page
- restrict category to only logged in User
- Category and tag urls return 404 error
- Dynamically creating content on custom URL without getting 404
- Removin /page/2 from pagination
- get parent_category class in loop
- Group Posts by First Letter of Title categories
- Category foreach Paging
- Display all of a post’s categories except the current category
- Alphabetize all but one category
- One category not displaying template updates
- How to display only category of blog without custom code?
- How to create a category or tag available exclusively to the admins and not to the users?
- Printing direct descendants of a category with WP_Query
- wordpress category.php query for featured news item, broken pagination and repeating posts
- Form Value of drop down category + Translation of ‘show option none’
- Echo class depending on Parent category
- Query pages by category
- List all authors by matching custom meta data on a category page
- Page view: Sorted by categories
- Anyway to hide a Category in the Categories section when adding/editing a post in WP Admin?
- How to display posts by author in a separate page, other than author.php?
- One color to category link depending on category ID
- Show subcategories and hide posts or show posts if not exists subcategories