You could assign the post only to the child category, and call the function like so:
the_category( ' ', 'multiple' );
This will output (notice the whitepsace between the anchor tags):
<a href="https://example.com/category/parent/">parent</a> <a href="https://example.com/category/parent/child/" rel="category tag">child</a>
Related Posts:
- Edit tag cloud widget number
- How to automatically apply woocommerce product title to all product images alt tags?
- exclude multiple terms using get_terms() function
- Counting number of posts in a category and its sub categories and displaying result using shortcode
- Allow authors to post only in categories they create in WordPress
- Add custom field to attachments in a specific category
- How to Populate the list of custom post type categories
- Php string not working in WordPress Functions.php [duplicate]
- show limited tags in an article
- display most popular tags in two columns
- Problems with function on function.php
- Use template for posts with a particular category grandparent
- Check if Product is in a Specific Category in Functions.php
- Highlight Current Tag in wp_tag_cloud
- Woocommerce – remove product from category
- get current product name in functions.php
- Way to querry data (tags) from a wordpress database?
- get post based on category chosen in drop down – The ajax method
- Swapping wp_dropdown_categories function with wp_category_checklist
- Pass Category Name, Description and Photo into variables to pass to jQuery
- How to pick the default selected value in wordpress dropdown?
- Get page that displays all children of taxonomy parent
- Dilemma of Populating all the categories in a drop down list
- Need to put a script above tag in header.php – WP 5.7.1
- Filtering a function’ output for a new continued function
- Displaying posts based on category
- How to get current post category details inside “loop”?
- Show all tags within a category?
- Post not populating for custom post type based on category selection
- remove specificly the last tag in all posts
- Dropdown category field inside repeatable metabox
- Display Visual Composer shortcode if a post belongs in specific categories
- Get parent category name when only child category is applied to a product
- How to move a post from one category to another
- Multiple Tag Filtering
- Notice: Undefined variable
- Hide a specific category title from displaying on site
- Populate Posts based on category selected using AJAX that means without page refresh
- All categories options or All categories not Populating
- Customizing the output of the archive and category widget without altering the original behavior of the widget
- PHP get_category() function redeclared
- Using Tag Groups: Displaying groups and adjacent tags of current post
- Notify admin (by email) if post added with specific tag
- Get category id for a custom category and display it in a class
- Insert wordpress tags below posts via functions.php
- Using tag to output text in Genesis?
- Is there a way to randomize and connect a background and header image?
- Trying to see if page is category or single and displaying title with appropriate heading tag
- Displaying categories
- Change background image based on tags
- How to insert the first letter in uppercase [closed]
- how to loop through blog posts in php
- Hide child of parent categories already hidden with “get_terms_args” – Woocommerce
- The search doesn’t work properly
- Exclude a category ID from the following function
- Count post with tags within one category?
- How to change product title color in shop page if product has specific product tag (Woocommerce)?
- Help with get_categories code
- Is it possible to go to the next post in the same category?
- How to create a linked tag list in my sidebar
- Shortcode content filter?
- Randomise upload filenames (or another solution to hide the original image URL from theft?)
- How do I display a user’s previous orders as a select box option on a product?
- Using file_get_contents with Gravity Forms uploads folder to create images in the media library returning false
- allow subscribers to see private posts without plug in
- Replace word in “the_content” only for index.php
- How do you add customer capability after Woocommerce purchase?
- How to get specific image in media library with php
- Function set default image when image not present
- Adding country tags automatically
- Custom location for attached images
- hover image appears below placeholder instead of overlayed
- combine Code 1 with Code 2
- WooCommerce – Reset quantity input field when variation changes
- Query all posts of a custom taxonomy term
- Get first URL from post content
- Setting custom canonical urls
- Handling Body class based on Template
- Trigger popup in a php if/else statement
- Setting a cookie upon specific URL visit
- Get_avatar filter?
- Can’t get page content in WordPress
- WordPress child theme fails to override parent navigation menu in /inc/structure/header.php
- How to use transient in this code for related post?
- Adding Default Settings to Theme My Login plugin
- Image as Sales Badge
- how to make separate field in wordpress user_data_
- Function not working at one place
- jQuery not defined
- Displaying the Month and Year that a page was Created?
- Changing custom logo link
- Add a class to the anchor tag on HTML5 gallery
- Conditional Header in wordpress
- Remove meta description on certain pages
- Creating a related post section based on similar categories
- Menu — How to add “current-menu-grand-ancestor” css class
- Use menu link or onClick to set a variable
- functions.php is being included twice, creating PHP fatal errors
- Hide Hamburger Menu On Specific Page (Front Page/Home Page)
- Automatically remove a canceled order in Woocommerce