Well, even at a quick glance, I can see that you are using the same meta box ID – postparentdiv – both times, which probably causes issues internally.
That said, this seems a convoluted path to take at all, and possibly an XY Problem.
Why do you need to scan for templates at all?
Related Posts:
- Query custom post type and showing its content
- White screen error for a custom theme
- Custom template with CPT doesn’t display on frontend
- Custom Post Type with Templates using Meta Boxes?
- next_/previous_post_link() `in_same_category` appears to fail when true
- Want to be able to sign up subscribers as authors
- providing access to post_id or post inside functions.php
- how to display custom taxonomies in front page
- I want to show a list of posts under specified categories
- I want to show a list of post with title that have link goes to that post and icon under the specific category to which it belongs
- How come Featured Image isn’t showing up in my Custom Post Type?
- Redeclare/Change Slug of a Plugin’s Custom Post Type
- How to use a custom post type archive as front page?
- How to change default position of WP meta boxes?
- What is singular.php?
- Displaying Custom Post Types In “At A Glance” Meta Box
- Sort search results by post type
- Display a query with multiple post types and same relationship on a single page
- Set posts of a custom post type to be private by default?
- What are the differences between custom post type and custom page templates?
- Page Template as Custom Post Type Archive
- Custom Taxonomy as Dropdown in admin
- Setting a custom sub-path for blog without using pages?
- How to completely disable a taxonomy archive on the frontend?
- Custom post status not working
- how to group custom post types
- Add Content to Page without shortcodes
- wp_dropdown_categories in custom post type with custom taxonomy
- clients list using wordpress
- Loading custom page template via plugin
- Post formats “audio” and “video” only showing in index.php
- Ordering Posts List By Taxonomy Terms?
- expire wordpress user posts
- echo value from ‘select’ field type into page template using cmb2?
- Creating a Custom Post Type for Inserting Preset Content into Post & Pages?
- WordPress keeps fetching the archive page instead of the template page
- Forcing all posts associated with a custom post type to be private
- How to add custom template in plugin?
- Why is get_post_format() for “Standard” returns empty
- Exclude add_filter from the admin
- How to quickly switch custom post type singular template?
- Find callback function for custom taxonomy metabox
- Date archives for custom post type
- Custom post types and child theme
- WordPress 3.1 – How does one add sticky post capabilities to post types
- List custom post types in dropdown
- Add a Template to a custom post type
- How to use a dedicated template for the Custom Post Type from a plugin?
- How can I add dropdown widget/box to admin post page?
- Detect meta value changes when post is updated (post_updated)
- WordPress calls archive page instead of Custom Page Template
- Password-protect a custom rss feed
- How do I Make a custom post type get a custom post template in a plugin
- How to sort list of custom posts to get view like a tree of posts under categories and their children’s categories?
- Search everything (posts, pages, tags, cpt, meta)
- Assign Page Template Within A Custom Post Type
- Dynamic page.php template for custom post types
- Posts to expire (deleted) after a date
- Custom post type archive and single.php files not working
- How to Removing fields from the Media Uploader/Gallery on a Custom Post Type Edit Page
- How to override parent theme function through the child theme [closed]
- Best way to style first post differently?
- Using Default WordPress Custom Header Image Crop Feature in a Post Type / MetaBox
- Page Templates – this code only works for one Custom Post Type
- Pagination on a custom page template
- How do I add a custom post type to the Featured Content in twenty fourteen theme?
- Automatically assign a custom post to a custom taxonomy based on custom field value
- Exclude Custom Post Type & Pages From Auto-Tag Function
- Conditional two level dropdown filter for custom post type
- Dynamic dropdown custom post list based on dropdown selection
- Saving multiple Metabox contents
- Limiting number of custom posts shown on taxonomy page
- Custom Post Type – Archive page title
- WordPress custom post type Single.php?
- if && problems with transition_post_status
- Single Page WordPress CSS and JS links
- Is it possible to insert text into an html tag using functions.php?
- Custom user role not working as expected
- Set default option in dropdown of WP_Query?
- Custom post type loops with different page templates
- Multiple templates for custom post type
- custom post type upcoming post and past post
- How do I create a custom post type for a training CMS in WordPress?
- Dropdown list of a custom post type
- Returning Variables back into a template
- Limit Authors to their Own Posts on front-end excluding admins
- Custom Post Types, Page Templates and Pagination. Why do I get a 404 Error?
- How do I create a page template to display a custom post type?
- Add multiple custom post types in functions.php, but only one custom post type show in dashboard
- Multiple Content Block
- Unable to save or update postmeta for custom post type via action using save_post hook
- Display custom taxonomy as dropdown list
- Filters post in admin with dropdown select, custom post type
- How to make an archive page displaying posts in a date range
- Display Posts of a Category in Alphabetical Order (Custom Post Type)
- Custom Post Type slug same as page name causing a conflict
- Beginner question: Accessing functions.php through admin web interface in order to import custom post types?
- Append taxonomy terms as class names in markup?
- How to: add option to add more checkboxes on custom post type
- Control Custom Post Type template from a plugin