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
- How to change permalink structure for custom post type and it’s taxonomies?
- How to display only 3 main categories, separated by commas, since they are marked in the post?
- Change role after the user has read all the posts in a category
- How to control which category will be picked for the slug of a post?
- How to order category.php loop by ‘meta_value’?
- Add category to custom post type automatically, using category slug
- Display Categories Assigned to a WooCommerce Product
- Display Only One Category
- Connecting WordPress gallery to custom categories (taxonomy)
- Custom Taxonomy: Parent still counting deleted Child
- Custom Category/Subcategory structure
- If statement within PHP echo
- How to show author name only if the post is in a specific category?
- Are Category or Tag Archive Pages Possible?
- How to Exclude post from a category
- Hiding a Categories content on just the Homepage ‘Posts’?
- Assign category to new post via URL
- WordPress custom Query for Posts in Category display posts multiple times
- Categories list into registration form
- Multiple Loops on category.php with pagination on last loop
- Why does accessing url by category cause issues with post types?
- Why does my taxonomy have a category style div id?
- custom page for custom Taxonomy
- How to remove one specific category (uncategorized) from post permalinks
- Combining a meta_query with a category filter
- Theme for subcategories
- Showing posts from 2 categories only on category.php
- Posts not listing out sub category in hierarchy
- Display all categories as plain text
- Change Default Content when Creating a Post based on Previous Category Choice
- show only sub categories if available?
- displaying the last product comment in the woocommerce category
- Get slug of current category in functions.php
- Show Posts via cat+cat in URL that are in both Categories doesn’t work
- Same category and post base
- exclude certain categories form archive widget
- How do I make an array to get the category name, dynamically, in an archive template?
- Hide specific category tag on single post page
- Filtering posts in category by tag URL
- Grab all the posts for particular category
- Get and display category name by category description
- Category pages redirecting to tab on Posts page grid
- How can I add different custom fields for each category in the same post?
- Cannot get to work tax_query array for terms
- Custom Archive Template for Multiple Categories
- I want to show recent post according to category of the post in single.php?
- Limit amount of categories displayed in a post
- Category and Posts in front page
- how to get postmeta info based on multiple categories?
- query.php – multiple is_category functions
- showing tag beside catagory
- Add advertising box to a specific category page
- Custom Post Type – Admin Columns
- How do you add Author and date Published on Category Pages?
- Is it possible to setup Category wise Subsciption?
- How to pass multiple checkbox values to wordpress query?
- Twenty Eleven Theme [duplicate]
- If searched in a category show different 404 page
- display certain category on custom template page
- List products from current category
- Remove /category/ from category (archive) page URLs (without using a plugin)
- How to show posts of a specific category