Display hierarchical structure of Custom post type in UL LI
The advanced solution is a Walker. But simplest sotution is a recursive function, which will work just like Walker. You can use one below: function wpse343409_get_recursive_posts( $type=”page”, $parent_id = 0 ) { // default parent 0 means only top level posts $posts = new WP_Query( array( ‘post_type’ => $type, ‘posts_per_page’ => -1, ‘post_parent’ => $parent_id, … Read more