Because you are echoing the $childcat->cat_name each time a post passes the validation.
Remember that you are inside the loop and for each post that matches your condition your are echoing. You seem to be wanting to print a list of categories that are a child of 19 but I don’t see why you’d go over each post to do that.
I would give you a solution but I’m not sure where you are going with this, if you share what you are trying to accomplish I will update my answer
Related Posts:
- Display Categories or Subcategories with name & description in category.php
- Page to output sub-pages (children)
- Get the children of the parent category
- Check if a post is in any child category of a parent category
- How to make child categories recognize parent’s template displays
- How can I calculate the total number of categories at different hierarchy levels?
- Show children of top level category only
- WooCommerce – Display product child categories from specific parent
- How can I make wp_list_categories output li with category-slug as class, for its children?
- Showing current subcategory
- WordPress Child Category Display All Posts
- get_children() not working properly – Only on one post?
- Show only first children level of current category?
- Query Posts Exclude Entire Category
- Category shows only top level child categories
- Need help with category listing!
- How to show only subcategories in parent category not parent category?
- Showing categories and subcategories with posts
- Child Category Image
- Give Children Unique ID’s
- get_pages displays only parents instead of children
- List child categories from parent category on custom taxonomy page
- Check is category parent with ids from the childs – get_term_children
- Check for parent category
- Show subChild categories
- Get first level children of a page ID
- Getting child category id (help with improving my code)
- How to create template for children category?
- Show all child categories associated to post ID within loop
- Need list of child category post titles sorted by child category
- Children categories not shown in dashboard
- list first post of Child Category on Category page
- how to display page title only for child category pages
- category & sub category order issues in wordpress
- Differentiate Between Parent & Child Categories
- loop mix my child-category and parent-category
- How to retrieve posts from parent category, splitting them per children when displayed?
- get_category_children/ the new get_term_children not work
- List all subcategories from category
- Force WordPress to Show Pages Instead of Category
- Load custom posts with same tag as page
- 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?
- Add default content to post (for specific category)
- How to get dynamically custom post type that are under a certain category
- How to show related posts by category or custom post type?
- Is it possible to put next and previous category links?
- Custom/separate categories for custom post type
- Woocommerce – Get product category 2nd level category
- Hide post meta data on a specific category
- New categories are now going to 404s
- How to prevent empty category to list content of sub categories?
- “Reversable” and “Re-useable” Subcategories (or other taxonomic structure)
- How to set post expiration date and time and move the page to archive after expiration [closed]
- Full text articles in the rss feed (i.e. without the more tag)
- Saving category to a post, before publishing the post
- Solution for ascending order in a category
- Why do my categories redirect?
- Restoring default article pagination on archives – Removing custom limits
- Applying A Category to Existing Posts Where Page Title Matches Regex
- how to get child category title and image
- Adding custom post type to count in category
- Removing subcategories from permalinks [duplicate]
- How to query categories with Advanced Custom Fields?
- Wacky taxonomy in wordpress
- Link to the next/prev posts in index loop in same category?
- Get latest post from all categories except one
- get_the_categories() but exclude children of “Uncategorized”
- How to exclude a particular category from the category list
- Create a Category with a front-end post
- 1 post per category on homepage and counting those posts
- Exclude category to “the_breadcrumb” functions
- Global navigation in multisite: problem with categories
- Migrate the posts of a category to another blog as a custom taxonomy
- Woocommerce only display child category when parent is checked (on add new product page)
- How to hide a category or tag everywhere EXCEPT for use with get_posts
- Show parent category wp_list_categories wordpress
- Taxonomy custom check box meta field not getting saved
- Subcategories randomly not working after page/post/category edit in wordpress. Fix: saving permalinks twice
- In if…else condition, the else statement shows even if if statement is correct
- How to show some of category in wordpress
- I just want to list ONLY the child categories, but not grandchildren
- How to Change Sort Order of default WordPress Catgory Widgets?
- how to avoid reloading/refresh the page when displaying the post of wp_list_categories
- get_adjacent_post_link excluded_terms ignored
- Make an array listing custom taxonomy
- Get category id for a custom category and display it in a class
- Include category name in page template
- How to set a link to custom archieve page
- Category base 404 – fix
- Editing “Kahi’s Highlight Used Categories” plugin code – highlighting parent and child category in post page
- Categories to A News Page
- Duplicate homepage to show posts from 1 category
- Help Me “in_category” with echo? [closed]
- display all posts in current category
- Make this jQuery toggle snippet target each list item individually [closed]
- How can I show second most recent post in sidebar, if most recent post is open in the browser?
- Preset category checkbox from URL parameter when creating new post
- Link to a specifc category?