The best way is using WP_Query. I think your error or plugin error could be that the ‘post_type’ of childs is not define.
WP Query : https://codex.wordpress.org/Class_Reference/WP_Query
global $post;
$args = array(
'post_parent' => $post->ID,
'posts_per_page' => -1,
'post_type' => 'products', //you can use also 'any'
);
$the_query = new WP_Query( $args );
// The Loop
if ( $the_query->have_posts() ) :
while ( $the_query->have_posts() ) : $the_query->the_post();
// Do Stuff
the_title();
echo "<br>";
the_content();
endwhile;
endif;
// Reset Post Data
wp_reset_postdata();
Related Posts:
- How To Limit Hierarchical Pages Depth (For Custom Post Types) To Children Only
- Custom post type hierarchical permalinks not behaving as expected for parent/child pages
- Custom Post Type Child Pages
- How to create a permalink structure with custom taxonomies and custom post types like base-name/parent-tax/child-tax/custom-post-type-name
- How to set parent-child relationship between differents custom post types
- Integrating a custom post type into a page hierarchy
- Nested custom post types with permalinks
- Change custom post type to hierarchical after being registered
- Custom Post Type as Page parent
- How to handle a hierarchy with custom post types
- Custom Post Type Permalink For Parent/Child, 404 Page Not Found Error
- Child pages on hierarchical Custom Post Types 404s
- How can I combine posts of different types in one hierarchy?
- Custom Post Type ‘hierarchical’ Help!
- How to show term-specific post list, without posts associated with child terms?
- How to query for posts (in hierarchical custom post type) that have children?
- wp_list_pages doesn’t work in hierarchical custom post type
- Post type hierarchy
- Detect if 1st, 2nd or 3rd level custom page?
- Hierarchical Custom Post Types or Similar
- Parent / Child formatting in a list of post of a custom post type
- Child page in custom post throws 404 page not found
- How to create a permalink structure with custom taxonomies and custom post types like base-name/parent-tax/child-tax/custom-post-type-name
- Share parent path between Custom Post Types and Pages?
- How to Combine Two Custom Post Types into Single Permalink Structure
- Custom Posts Hierarchy? (State/City/Restaurant)
- Automatically populate a hierarchical taxonomy from a custom field
- Hierarchical Custom Posts – Highlighting Current Post in Sub-Menu
- Remove base slug in permalinks of hierarchical custom post type
- Modifying Custom Post Type after registration (will it affect content?)
- Hierarchical Custom Post Types – Show only parent on tax archive?
- Display custom post type in hierarchical order with get_terms
- Should I use custom taxonomy or custom post type
- How to get the parent of a non-hierarchical custom post type being edited in Gutenberg
- Custom rewrite rule for hierarchical custom post type
- List children on child post
- Hierarchical Custom Post Types in Array
- child of post type (custom)
- WordPress Custom Post Type Children Template
- How to set a CPT to have a page as a parent, then rewrite urls accordingly?
- Rewrite Rule for showing Parent/Child Relationship between Two Hierarchical Custom Post Types
- Need help with permalink rewrites for Custom Post Types with hierarchical relationships
- Versioned Custom Post Type (Not the same as revisions)
- Rewrites/query for multiple hierarchical custom post types
- Custom while loop for hierarchical display of a taxonomy
- Removed custom post type slug but not working for child pages
- Get the taxonomy of a post hierarchically
- Custom Post Types hierarchy and rewrite
- Custom post type / taxonomy rewrite archive page 2 gives 404
- Create more category hierarchical depth for custom post type/taxonomy plugin (widget)
- Hierarchial Custom Post Types/Taxonomies
- Hierarchical permalinks for custom post type and taxonomy
- using wp_update_post for updating custom post type
- Create a permalink structure with custom taxonomies and custom post types gives 404
- Custom Post type & Taxonomy 404
- Is it safe to change a Custom Post Type from “hierarchical:false” to “hierarchical:true”?
- List of child custom post types lists all custom post types
- get parent content inside child posts
- page template for custom post type
- Redirect to first child on Custom Post Type (without template)
- Templates for hierarchical custom post type
- Creating a non-hierarchical Taxonomy that behaves like categories
- Query to get child pages of current page and display it in action hook
- How to query for posts (hierarchical custom post type) that have children but are NOT top level?
- Migrating Hierarchal Taxonomy Categories Between Post Types
- Ideas on how to organize a project [closed]
- Add search to ‘Parent’ dropdown
- How should I structure complex content hierarchies?
- Query all post types but limit to parents
- List child categories from parent category on custom taxonomy page
- Custom post type hierarchical loop in Homepage
- Does “Custom Post Type” can have page hierarhy option?
- If/Else child list for Custom Post Type single template within loop?
- Creating an Events Feed with Sub Pages/Posts for Each Event
- Migrate Custom Post Type with Custom Fields data and parent child order
- How to set a ‘page’ as parent of a custom post type?
- Permalink with hierarchy of Custom Post Types
- How do I find out which (page) template file my custom child post is looking for?
- How to convert hierarchical Pages to hierarchical Custom Post Types? Slugs get a number as if they were duplicates
- How to use POST method using custom wordpress button?
- Standard Page Child of CPT Not Found (404)
- Custom Post Type parent/child relationship rewrite rules for permalinks
- Attempting to get number of grandchildren of page in WP_Query loop
- Custom post types & Pages hierarchy – Error 404
- Create a Hierarchical List of Custom Taxonomies AND Posts
- Display posts of a hierarchical custom post type excluding parent posts
- Most efficient way of showing children posts?
- Hierarchical Custom Post Type Walker?
- Custom Post Hierarchy and users
- WordPress custom post type and page
- Custom Post Type categories at edit post not hierarchical
- Child Theme problems
- How can I add a “fake” parent into the permalink?
- Custom post type child page 404
- taxonomy term names in custom post type permalink structure
- Cross post type parent page added parent page to permalink but give 404
- Custom taxonomy archive not showing posts of certain child taxonomies
- Specifying Default Template for Hierarchal Custom Post Type [duplicate]
- Hierarchical Custom Post Types
- How to add a regular page under a custom post type?