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)?
- Error Warning: Declaration of description_walker::start_el after PHP upgrade [duplicate]
- Mega Menu Walker
- Autoloading in Child Theme
- How to add a class to the attachment images
- Execute a shortcode when clicking on a image
- add_rewrite_rule with bottom priority doesn’t handle the WordPress pages
- Change logo based on incoming domain
- PHP code inside shortcodes
- How do I display a user’s previous orders as a select box option on a product?
- Remove meta description on certain pages
- Image media upload metabox
- How to combine wordpress_logged_in cookies in one cookie?
- Woocommerce related product text
- esc_html_e() is not translating string in wordpress [closed]
- Limit 1 global comment per minute
- responsive.css in the WordPress should be prioritized
- wp_force_remove_style’ not found
- Pagination on Custom Post
- how to save checkbox data for custom setting?
- How to keep the capability of users and disable Gutenberg editor in WordPress?
- Enqueing External JS on the remote server JS
- Get the name of menu item with wp_nav_menu
- How to add aria role and schema markup to custom walker container
- Remove submenu item from list
- Customize field names in backend profile edit page through function.php [duplicate]
- How to exclude labels from certain categories in a shortcode?
- Time Delay a URL Redirect for Specific Page
- Isn’t Returning Value While Using SELECT COUNT(*) FROM {$wpdb->prefix}
- Run a sql (update) after 12 hours after the user login. Woocommerce users
- Wp_Schedule_Event every few minutes doesn’t work
- File from parent theme imported to child theme doesn’t work – any ideas?
- How to center all text body in single.php at once?
- Access WP files on “server 1”, from “server 2” – using wp-load on an external website
- wordpress all post filter by year
- Pulling a variable into the wp_nav_menu function
- Popular Post Not Show
- how to set category name for a post
- Problem with function.php.. like
- Echo get_option displays as text
- Need help with Deprecated: Non-static error when update PHP 7.4 -> 8.1 with Dyad 2 theme
- Frontend redirect after delete post in wordpress
- Link on post title only if post have content
- How to save a post to a Custom post type and copy the information to another Custom post type?