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
- Query for posts belonging to multiple categories
- how to display all categories in wordpress?
- How to create an automatic MultiColoumn MegaMenu with Categories WordPress
- Is There a Difference Between Taxonomies and Categories?
- Get Posts Under Custom Taxonomy
- Adding Fields to the Category, Tag and Custom Taxonomy Edit Screen in the WordPress Admin?
- List all subcategories from category
- How To Find Out WordPress Category Table in MYSQL?
- Add custom field to Category
- Get Category ID inside Category template
- Only one category per post
- Adding categories to custom post type in permalink
- WordPress Multisite – global categories
- Get posts from sites in Multisite?
- add_action hook for completely new post?
- Can I add a Category Metabox to attachment?
- WP REST API: filter by category 1 AND category 2
- How to display related posts from same category?
- How to Display Product specific to a category with WooCommerce Plugin? [closed]
- How can I allow commas in tag names?
- How To Get Parent Category Slug of Current Post
- Custom Nav walker display current menu item children, or siblings on no children
- Display All Products by Category with WooCommerce
- What is the difference between a “tag” and a “category”?
- Display current category title on category page
- Is there an easy way to make a meta box have the tabs like the Categories meta box has?
- Get the first image from post content (eg.: hotlinked images)
- Hide specific categories from category widget
- How to check if I’m on the last page of posts?
- How to change permalink structure for custom post type and it’s taxonomies?
- Get the first post term
- Display posts from the same category using next/previous post link
- How would I get a taxonomy/category list inside a Gutenberg block?
- Check if Current Category has Children
- Can I set a default featured image for a category?
- How to export and import taxonomies (category, tag and/or custom taxonomy) and their terms
- How to show all posts of the category in wordpress?
- Force category choice before creating new post?
- WP_Query by a category id and a custom post_type
- Gutenberg editor add a custom category as wrapper for custom blocks
- A check for if is parent page, if has children, if has grandchildren
- How to show related posts by category
- WooCommerce: List All Categories
- How to get category and archive title?
- Get category ID from category slug (not working)
- How do I remove “Uncategorized” from posts with more than 1 category?
- How to add category to: ‘wp-admin/post-new.php’?
- Remove the category/taxonomy description field?
- Get rid of WordPress category, tag and author archives?
- Individual rss feed entry length for categories?
- How can I create a category landing page followed by pages of posts?
- Remove parent category from permalink? Basically only have the child category?
- How To Create A Paginated List Of All Categories On My Site?
- Get the category from an ID of a product?
- Custom permalink structure leads to be 404 on pagination
- Add ‘Description’ to taxonomy ‘Quick Edit’
- Retrieve Product category ‘NAME’ by product category ID – WooCommerce?
- Display random categories on the front page (Finding and Editing Theme Functions)
- Posts URL structure like site.com/category/the-post-title
- Can’t custom taxonomies have same terms (slugs) as categories?
- How to get permalinks with category base working with sub-categories
- How to remove the term “category” from category pagination?