You only create an instance of your class on admin requests, so your CPT doesn’t exist on front end requests. Instead of:
if( is_admin() )
$cpt = new CPT('cpt_child');
create the instance on all requests:
$cpt = new CPT('cpt_child');
Related Posts:
- Custom post type archive sorted and grouped by date in post meta field
- How to enqueue scripts on custom post add/edit pages?
- How to remove custom post type archive
- How to use a custom post type archive as front page?
- remove custom post type permalink
- Custom Post Type Archives by Year & Month?
- Get custom post type slug for an archive page
- Create a custom archive page for a custom post type in a plugin
- Custom Post Type Settings page, choose page to display archive
- Adding a menu item for a Custom Post Archive
- Custom Post Type Archive Page not showing
- Adding custom post type archives to a WordPress menu
- How to set a custom post type to have viewable future posts
- Custom Post Type Template – Archive
- Page Template as Custom Post Type Archive
- Custom post type yearly/ monthly archive permalinks
- Can’t get post id on page that is a custom post type archive
- How to change “Draft” string for status of custom post type to “Unavailable”?
- Meta_Query as a way how to setup CPT permalinks – is it a good thing?
- How do you create an archive for a custom post type from a plugin?
- Action hook on Edit custom post type?
- Proper way of making custom post type landing page or archive page
- Custom Post Type Archives by Date with Custom Permalink
- Unregister post type from child theme
- Custom post type save_post action not firing
- How to correctly get post type in a the_title filter
- How to intercept publish post for a custom post type “event”
- Why The Init Hook For Custom Post Types
- How to List All Custom Post Types Names (Not Posts)
- flush_rewrite_rules on save_post Does Not Work on First Post Save
- Change title in head on Archive page
- Custom Post Type Archives with 0 Posts Redirects as 404
- How to show more posts on an archive page?
- How to filter custom post type archive by meta value
- What are the advantages of using a custom post type archive?
- Page is defaulting to archive page and not designated template
- custom post type archive page url to point to Page permalink
- “Edit” option for custom post types archive page
- Custom Post Type archive as front page
- Better to use a post type archive, page template, or shortcode for generating a highly configurable CPT archive?
- Get monthly archives for custom post type
- Is it possible to remove the posts_per_page limit on a specific post type?
- Add Settings to Custom Post Type
- With what hook can I address all posts from all custom post types when they are published?
- Is it possible to have an index page for taxonomy term for each custom post type it is assigned to?
- Custom post type permalink structure with the category also acting as an archive
- Make the ‘all’ filter default instead of ‘mine’ in a custom post type
- How to get_queried_object on multiple objects?
- Custom Post Type Works but Still Shows “Page Not Found”
- Dynamically Create Terms in Taxonomy when Custom Post Type is Published. Almost There!
- Assign Page Template Within A Custom Post Type
- Custom Post Type / Taxonomy Slug / Post Title with post type archive
- Rewrite custom post type url’s adding meta box values
- I can’t set meta_key in my custom post type query
- Hide child term posts on parent term pages
- Posts per Page on custom Taxonomy Template
- Compare 3 custom fields and sort by oldest
- WordPress Custom Shortcode Conflicting with Media Library
- Post type archive page not working
- Adding Sticky functionality to Custom Post Type Archives
- paginate function in archive for custom-post-type
- Adding custom post types to archive.php
- Custom Post Type – Archive page title
- Alphabetical sorting of custom post type – one letter per page
- List all posts in Custom Post Type but group dynamically by Custom Taxonomies
- Archive page for taxonomy of custom post type
- WordPress custom post action hook
- Add meta data to the custom post type ARCHIVES page
- action init hook and get_post_types
- Should I change these content meta types before building complex archive page?
- archive-{$post_type}.php not loading. instead the default archive.php loads
- Getting taxonomy terms used by custom post type
- Archive or taxonomy pages not working for custom post type
- Create Custom Post Type Archive Page with Sub Categories Navigation Sidebar
- Custom Post Type archive giving 404
- What hook should be used to programmatically create a post only when master post is updated?
- pre get posts changing the query
- How to register custom post types in a plugin?
- Actions that Run on Admin Edit Page Load After Posts Are Queried
- How to create archive page for taxonomy terms within custom post type
- How to make an archive page displaying posts in a date range
- Categories and Tags not working!
- Custom taxonomy template not working with simple loop. Multiple CPT using the same taxonomy
- Using pre_get_posts to Filter Posts
- Remove “Get Shortlink” button in admin of custom post type
- update_post_meta() whenever custom post type is updated
- Custom query variable – get wordpress to redirect to nice permalink url
- How to get Custom Post ID by adding filter to child theme’s function
- WordPress custom post type archive with description
- Custom-post-type-archive: posts sorted/filtered by year?
- Custom post_type search’s $wp_query->query_vars do not correspond
- How to list custom post types?
- I am facing problem in my archive page , it is partially working
- Check Title Unique Or Not and If not error message and dont save
- add_rewrite_endpoint() and Custom Post Type Archive
- Custom post type archive page pagination
- Add the current menu item CSS class to a custom page type archive in WordPress menu
- Display Next/Prev when looping Custom post-types archive?
- Add custom post type archives to search results?
- Archive page for custom post type not working