With get_term_children
you are retrieving a flat array of all child terms. What you want is an array with only the first child terms. Unfortunately there is no immediate way to retrieve this, so it has to be done in two steps:
$parent_term = get_term_by('slug', 'bedroom', 'your_taxonomy_slug');
This gives you the ‘bedroom’ taxonomy term. Now you can use this to find the direct children:
$children = get_terms( 'your_taxonomy_slug', array( 'parent' => $parent_term->term_id ) );
This returns an array of child terms.
Related Posts:
- How can I get archives for specific category without category_base in the url?
- Modify text after post count
- Get archives as array
- Get posts from a top category and group by child categories
- Any kind of custom post type in the front page and in the archive listing
- Trying to hide subcategories which have categories without posts
- Exclude a specific category link from archive / front page
- Filter the post listing for a particular category from archive month list
- WP Archive & Category Pages not filtering
- Sort results by name & asc order on Archive.php
- Default archive URL wordpress
- Increase number of posts in archive page
- Why are posts from custom post type not displayed in “category” archive?
- How do I place content on archive pages but not on main page?
- Decreasing the Memory Consumption of a WordPress Site?
- is_archive() returns false on the archives page
- Archive by Year
- Display posts links from a category group by year
- Display list of Sub-Categories and the posts they contain, within one main Category
- Sort category page with custom field
- Archive listing of posts by publish year (multiple years)
- How to create tabled index of posts in a certain category
- Regex problem in an add_rewrite_rule
- Single.php Active Category Class
- Making next_posts_link(); return posts by month
- Category Specific Archive
- How to have Multiple Archives Widgets, one archive widget per category (in a different page)?
- Count posts for each year
- How can I get the ID for an archive page? [closed]
- “Sticky” posts for each category (archive.php)
- if in_category on archive.php
- Change behavior depending on content length
- get_categories for custom post type and filter by custom taxonomy (brand) and list child categories of a defined category
- Cache previous versions of website?
- Category page only displaying the posts from a custom type
- custom taxonomy archive by year
- condition for only if is archive for default post type
- Displaying year, month and day archives differently
- What’s wrong with my date_query?
- How we display Archives for specific categories
- Category List (Archive) Page Template By Category
- CPT Archive with core Category
- Show archives by year from just one category
- Archive.php filtered by pre-determined category
- How do I call posts with a certain tag?
- Category being displayed without base parmalink
- How can I define a custom archive for childs of a specific category?
- Custom post type archive page thinks I’m not logged in
- Constructing An if Statement with is_category(); in archive.php
- next and previous year month and day for archive page
- Get current title of archive.php
- How to show months in wordpress archive page?
- How to count the number of archives there are
- How do I remove a category from a wordpress loop>
- Why is my archive.php redirecting to front-page.php?
- How to get post archives urls list without any markup?
- How can I loop only months foreach year?
- Only display archive subtitle on the first archive page
- Bootstrap Accordion with Dynamic content WordPress Archives Unique ID
- What do I need to style for the page after wp_get_archives?
- How to hide specific post type from archive?
- On my archives page, I can’t see my custom post types catergories
- Add hour to archive link?
- WordPress archives in header -necessary?
- How to display post in custom file not in archive file?
- WordPress showing wrong category name
- Media (images, videos, etc.) not showing on Category page
- Display an archives name
- Archive of year for some categories using the featured image
- Custom design calendar archive
- Archives and Categories in Custom Menu
- How to display dynamic additional contents on archive pages?
- How to show all the posts under the same Year in a page WordPress?
- How to share the author’s archive?
- How can I show a list of posts using the dynamic selection box?
- My page is shown as archive in my site
- How can I noindex my archive pages?
- Show the parent taxonomy by creating shortcode in woocommerce?
- How Can I Display the Category Description in a Theme with no Category.php or Archive.php?
- Display Category yearly wise in wp
- Change Title Based on Taxonomy Filter in archive-{cpt}.php
- Get all posts from db between 2 specified months
- get_the_terms_list output last child only
- Display Day names with wp_get_archives instead of date
- How to get related category/categories in WordPress archive page
- Category archives
- archive.php can’t find categorized posts
- Category archive in menu
- How can I set up the URL for a category archive for a custom post type?
- 2 loops in archive.php (one for each category)
- How to create an archive section of a WordPress site
- Category Archives: Show posts categorized in parent category only
- How to get pagination working with “Pending” Posts
- Create page like custom post type list in WordPress
- All post of child category not in top category
- List archive year – post by post
- how to implement next/prev within category archive?
- How to link ACF relationship field to the new Query block in Full Site Editing
- How to have infinite scroll consider passed parameters?
- Sort Category Archive pages and place sticky posts first