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
- Linking Two Post Types
- Pull Two Posts Into Custom Post Type `single-cpt.php`
- Problem excluding category from get_next_post
- How to check if last uri segment is a custom post type or taxonomy term?
- Get the post children count of a post
- Quickest way to get last or oldest post date – WP Query
- Detect if 1st, 2nd or 3rd level custom page?
- How to use custom fields to enable sticky posts on custom post types?
- Custom post type hierarchical permalinks not behaving as expected for parent/child pages
- Show Two custom Post type and their posts on category page
- Custom post type and body_class: Remove “blog” class
- How to get the post type from a category id?
- Create custom PAGE with register_post_type
- Getting posts under the custom post type ui category
- Page vs Custom Post Types Differences/Issues
- create parent post using wp_insert_post
- Turn on and off custom post type from admin?
- I would like to have different styles for my posts based on the content of each post
- Exclude pages in archives results
- Make parts of your wordpress website completely built with data from external APIs?
- JS innerhtml changing style when using AJAX
- Assign same parrent Page to pages AND custom post types
- Several post types on WP Query by tag and taxonomy
- Top Level pages in wordpress giving 404, but child pages working fine
- wordpress remove views from action links in a custom post
- the_content(); of custom post type treated as an array or object
- Conflict between wp_list_pages and get_posts – list pages not displaying
- Add to ‘action’ within post.php to allow more actions when editing a Custom Post Type in a plugin
- Get post format
- Template code to split a post and print a custom field?
- Send post changes to set email addresses (not users or subscribers)
- Custom Post type registering as page post type
- Custom Posts and Posts – next_post_link and previous_post_link not working together
- Enable comments for post when comments meta box removed
- Admin slow on Postlist (over 30k Posts in Database)
- Get_post_custom not fetching value from array wordpress
- Display Parent-Child Posts in specific order by comparing IDs in array
- Post category behave like a Post in back office menu
- Save data is post using php front end
- Custom taxonomy terms hierarchical navigation
- What is the best way to structure posts for the same event happening in different years?
- How to display custom field in product description?
- How to display posts with plugin (advanced custom fields) field groups?
- WordPress – display relationship between blog posts and custom posts
- Custom page with no headers, footers and its own CSS, Javascript
- Add custom template ‘sub-page’ to Custom Post type?
- Custom Post Type Single Page and Archive Page redirects to Home Page
- SEARCH QUERIES – REVERSE OUTPUT
- Is there a way to create a sidebar of bullets
- Disable Sidebar on certain pages
- I cannot display custom posts in custom taxonomy
- How to get the posts that my following users are liked?
- How to insert post 6 times after user register like ask.fm
- Creating custom post type relationships
- How To Loop Through list with Custom Post Types
- erase post excerpt limitation [×]
- Is it possible to make one of two custom fields in Custom Post Type UI Required but not the other?
- General question about Parent and Child Post type relationships
- Using custom post types within a section of a template
- Pulling in a particular post into a single page based on the post id passed into the code
- Custom My account page and custom page for editing posts
- Get post from custom post type that title is like custom string [closed]
- show posts under custom post type with same autj
- Two pagination in one page without AJAX