Update 1:
Thanks to @birgire for suggesting a better way:
wp_list_categories( [ 'include' => wp_list_pluck( get_the_category(), 'term_id' ) ] );
Try this in your single.php
template:
$current_cats = get_the_category();
$current_cats_ids = [];
foreach ($current_cats as $cat) {
$current_cats_ids[] = $cat->term_id;
}
wp_list_categories([
'include' => $current_cats_ids,
]);
Related Posts:
- Add inline style to get_the_category_list
- Single.php category entries not showing right colours
- How to check if a post is in categories x,y,z inludint their subcategories
- How to Highlight current category on category and single page template?
- Custom Single Post By Category
- Is it possible to use a single custom post as the site front page
- How do I get the category URL from get_the_category?
- Posts in multiple Categories different single.php
- Single post comment template not working
- How to get a list of term names of the custom post type im currently on in single.php
- Create single.php for specific category by category id
- Single.php Active Category Class
- How do I show google ads between post content?
- How to get category id in single.php wordpress?
- Help with figuring out the future post workaround
- in_category() works in single.php but not in page.php?
- Disable single view for specific post category
- Using wp_list_categories like the the_category (showing just current categories of a post)
- Only nextpagelink on wp_link_pages
- Display a post map on a blank/new page
- how to get the categories for a single product in a hierarchical way
- previous/next_post_link in the same sub-category?
- How To Pass Current Post Type ID from Single Template To Custom Page Template
- Is it possible to create rel=”noindex, nofollow” for a single post if contain bad keywords?
- Send to different single pages by category when multiple categories exist
- If in_category not working for multiple single.php pages
- How to make the link to the category for a post go to corresponding page number in archive?
- Single.php – Get Current Parent Category
- Custom seperate Single.php
- Set a cookie only in single posts
- Custom post type not respecting template hierarchy
- diffrent style for post single page
- Single.php Category Post Count
- WordPress object for comments frame [closed]
- Problems with my conditionals in single.php by category
- I’m having a problem viewing the Youtube video
- Get next post in same category not working WP 4.7.4
- Use different «Single.php» for custom categories
- Simple way to style posts of a single category differently in the loop and in single
- force https except one page/post
- Single custom post type template not working (single-custom_post_template.php) not working
- Link from archive-page.php to single-page.php
- What is wrong with my WP_Query Arguments?
- How to get nav to show current_page_parent class when on regular post (not blog), differentiated by category
- Changing the display of the themename_posted_on() function
- How can I check which archive has referred the single? [closed]
- Exclude single page from function
- Displaying links to all posts of the same category on the post page
- WordPress, alternative single post template
- Can I style single post that are in multiple catergories?
- get full real path of thumbnail post img wordpress
- WordPress – When visiting a `single post/ single.php` my category menu item link becomes active
- Ignore the Ad on Specific Categories
- custom wp_list_categories in single.php
- Show single post child category from a determined parent
- how to loop through this in blog single?
- loop in single.php of the same category
- Modify post template on Divi Theme
- I want to signin from first wordpress site to other wordpress website without registration..without using network mode
- Try to showing product file size on product single page
- Display Some text in some specific category not all category
- When category name and title are the same … WP will select archive.php instead of single.php
- Improve related posts
- Using template file for single post in sub-directory multisite
- List posts of assigned categories in list of all categories on single.php
- Code to display category-specific single.php is overriding normal single.php, too
- Get active term on single (CPT) page
- Display Referring Category on single post?
- Having single posts appear under the blog homepage and highlight menu items properly?
- Modify / Rewrite single template url structure
- Single.php loading fully on localhost but not on server
- explain why is_single doesn’t work
- How do I get a single page navigation depending on the previous page?
- Randomise results from a category page?
- Counting number of posts in a category and its sub categories and displaying result using shortcode
- How get a shortcode working in category description
- How to Remove Parents Category Permalink from Posts
- Disable single pages and archives and keep preview
- Using a portfolio_category slug in wordpress URL
- Nav menu category links not showing
- Display category posts before others category custom query [closed]
- Get Prevous/Next Post Specific Category Without Excludes
- Pagination is not working properly in Product Category/Tag pages
- Limit amount of posts made within a custom taxonomy
- How to show “teaser” posts on blog / archive pages, otherwise full posts
- How to display single post from custom post type loop?
- Alert Bar section within WP loop is displaying even though there are no posts
- Get posts under a category with SQL
- Add Date & Author Meta to Category Archive Page
- A dropdown with checklist
- How to get posts ordered by using their categories?
- Show Secondary Sidebar on Category pages (archive)
- ACF date picker to trigger category change
- Template category.php with page (no posts)
- Polylang and template files
- Custom Post Types – trying to make “title” display
- Exclude parent categories from recent posts list
- How to organise post by category and date
- Show post if in category
- Is there a way to combine categories and their hierarchy into the admin listing page?