You can set a post type to hierarchical when you register it with register_post_type
. Simply set the ‘hierarchical’ argument to true.
$args = array(
'public' => true,
'publicly_queryable' => true,
'has_archive' => true,
'rewrite' => true,
...
'hierarchical' => true,
...
'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'comments','page-attributes' )
);
register_post_type('my-cpt',$args);
Related Posts:
- Hook for post and page load
- Integrating a custom post type into a page hierarchy
- Custom Post Type as Page parent
- Custom Posts on Different Pages
- Custom permalinks – post type – hierarchical taxonomy’s
- Display “Post 2 of 4” on single post page?
- wp_list_pages doesn’t work in hierarchical custom post type
- Post type hierarchy
- Making pages also serve as taxonomies? Or give full pages to taxonomies?
- Trying to edit the single page from a Custom Post
- Should I use custom taxonomy or custom post type
- How i can add ‘N’ page of ‘N’ pages under posts loop?
- Allow non-logged in users to see a future post after clicking on a list of future posts
- No Permission to add new Page, Post or CPT with Admin role
- Including link to custom post type in ‘wp_list_pages’ function
- Multiple pages per post (not pagination)
- Can I change my post type to anything and my site still work?
- Display an authors post on a single page only when they are logged in
- How to set the mainpage of a custom post type?
- Render a Post or Page using the correct file
- Am I mixing up the concept of posts pages and categories?
- How to setup different permlalinks for posts and pages?
- How to set a ‘page’ as parent of a custom post type?
- Cannot save pages after migration
- Custom post types & Pages hierarchy – Error 404
- Most efficient way of showing children posts?
- WordPress Contents Migration
- One Post with different content, depending on a Page
- Cannot use pages created on WP
- Different post types arranged on one page
- How to display data with pagaination on backend?
- How to Associate Posts with Pages
- Why are my wp urls showing page not found?
- How do I hide single category post on my post page
- How to add a regular page under a custom post type?
- How to develop Knowledge center in WordPress Website
- List children on child post
- Restrict custom post type from appearing with ?post_types=
- Show custom post type filtered by category
- Hierarchical Custom Post Types in Array
- create parent post using wp_insert_post
- Turn on and off custom post type from admin?
- Missing Posts in Custom Taxonomy List
- Display random posts, but omit the post it is on?
- How do I do this with WordPress? Taxonomies?
- Disable block with taxonomies at post page
- I would like to have different styles for my posts based on the content of each post
- How can i add thumbnails images to particular post (using code not admin pannel) in wordpress
- Showing posts from different categories and from custom post type
- Get latest 3 posts from multiple CPT in one query
- WordPress Custom Post Type Children Template
- Use a hierarchical custom post type for a main blog and subblogs?
- Which post does a taxonomy term belongs to?
- List custom taxonomy specific to one custom post type
- Post image in WordPress not appearing on home page
- Exclude pages in archives results
- How to add a custom-post-type post within another custom-post-type post edit screen using AJAX?
- Meta query for custom post type ignored in main query
- Changing custom type name hides the posts
- Display Ad on Specific Categories
- Make parts of your wordpress website completely built with data from external APIs?
- Hiding posts by other users and non-logged in
- Update Post Meta for a logged in user
- Add custom field to Posts and sort by it
- Add custom post type settings to wordress default posts
- Trouble with CPT Child 404
- How to create custom url structure based on custom post type rewrite slug, taxonomy and category slug?
- Database to page routing API?
- Get related posts of child term of custom post type
- Two Custom Post Types Many to Many Relationship
- Problem with displaying posts in the CPT category
- JS innerhtml changing style when using AJAX
- Show titles, date of all posts on single category page
- Assign same parrent Page to pages AND custom post types
- How to set a CPT to have a page as a parent, then rewrite urls accordingly?
- Side effects of Script and Iframe in post
- Allow Static Page Load Dynamic Child Pages
- How to change the post type a theme shows by default?
- Set a checkmark in a category based on a URL-parameter
- Rewrite Rule for showing Parent/Child Relationship between Two Hierarchical Custom Post Types
- Several post types on WP Query by tag and taxonomy
- Update postmeta Parent when post_status child change
- custom post type category count shortcode
- Portfolio Page for Classic Posts
- Need help with permalink rewrites for Custom Post Types with hierarchical relationships
- Add post location with mile radius allowing search
- Rewrites/query for multiple hierarchical custom post types
- Get the category from custom post type
- Is it possible to store Custom Post Type data in separate set of tables and still have wp_post class functionality?
- Set up post page like JAMA articles
- Custom Post Slug same as Parents Category Slug
- Shortcode not working with post counter
- A case for Hierarchical Custom Posts
- Static page determines as home, but it is not
- Changing default ‘posts’ parameters with register_post_type_args
- Admin Column does not populate with data
- How to integrate a form (Ninja Form or Contact Form 7) with Custom Post Types?
- Custom while loop for hierarchical display of a taxonomy
- Prioritize posts in query by meta keys?
- Homepage’s content is dependent on the custom field values (set automatically), how do I get homepage to update without manually updating page?