WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to be able to select a parent post when i create a new post. I assume it should be easy just to make the 'page attributes' admin widget to work similarly for posts too. The use case is for this site: thedevs.org where i want to enable people to post projects then later on make new posts that are children to a project post and would be listed under the parent post. I am slightly new to wordpress but i play around with php quite easily. A working plugin or code snippet would help.

share|improve this question
possible duplicate of Use register_post_type() to modify an existing post type – Chip Bennett Mar 4 '13 at 19:40

The parameter that controls post-type hierarchy is called 'hierarchical', and is set when the post type is registered via register_post_type(). WordPress core registers the 'post' post-type with 'hierarchical' => false.

To override this setting, refer to this question.

share|improve this answer
Thank you, but sorry, i have no idea how post-type works or where i should plug in the functions to see the magic. Please help me like a 2 year old (in wordpress)... – TechyTimo Mar 5 '13 at 3:04
NOW, I have been able to create a new custom post type but I still dont see the 'page attributes' admin widget in order to choose parent. How do i make this happen? – TechyTimo Mar 5 '13 at 4:52
That's a separate question from your OP. Please start a new question, or else edit your question to change the scope, and paste in your register_post_type() code. – Chip Bennett Mar 5 '13 at 12:41

Adding this code on my ..mytheme/functions.php file sort of worked for me:

            /* Register Custom Post Type for Projects*/
            add_action('init', 'project_post_type_init');
            function project_post_type_init() {
              $labels = array(
                'name' => _x('My Projects', 'post type general name'),
                'singular_name' => _x('Project', 'post type singular name'),
                'add_new' => _x('Add New', 'Project'),
                'add_new_item' => __('Add New Project'),
                'edit_item' => __('Edit Project'),
                'new_item' => __('New Project'),
                'view_item' => __('View Project'),
                'search_items' => __('Search Projects'),
                'not_found' =>  __('No Projects found'),
                'not_found_in_trash' => __('No Projects found in Trash'),
                'parent_item_colon' => __('Post'),
                'parent' => __('Post'),
              $args = array(
                'labels' => $labels,
                'public' => true,
                'publicly_queryable' => true,
                'show_ui' => true, //false - to hide from the admin area menu
                'rewrite' => true,
                'query_var' => true,
                'capability_type' => 'post',
                'hierarchical' => true, //allow parent pages
                'show_in_nav_menus' => false,
                'menu_position' => 1000,
                'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'comments', 'page-attributes')
share|improve this answer

Just go through below Documentation and add the function in your functions.php https://codex.wordpress.org/Function_Reference/add_post_type_support

share|improve this answer
Please improve your answer. While the link might answer the question, you should include the essential parts of the answer here and only provide the link for reference. – Gabriel Feb 19 at 20:29

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.