WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

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 create "Custom Post Type" that will have next structure:

Post (hierarhy level)-(some-post-id)

Post 1-1 =>

      Post 2-2
      Post 2-3
      Post 2-4 =>
               Post 3-5
               Post 3-6
               Post 3-7
      Post 2-8
      Post 2-9
      Post 2-10

I need something like "Page attributes":


share|improve this question
Post types can be hierarchical - is this a question about url rewriting? – Stephen Harris May 10 '12 at 8:17
I want have custom posts type, like standart page, that have hierarhy level – Vital May 10 '12 at 9:26
up vote 1 down vote accepted

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' )
share|improve this answer
Once more, We must add into support, 'page-attributes' But still no results, because there will be only "order" option. I want have hierarhy like by pages, where I will can specify level (parent, grandchild, child and so on). – Vital May 10 '12 at 10:30
Indeed, I'd left out the 'supports' argument. – Stephen Harris May 10 '12 at 10:32
But still no results ;) – Vital May 10 '12 at 10:36
In what sense no results? - this works for me (without the '...'s of course.) Does the post type not register, or are you not seeing the page attributes metabox? – Stephen Harris May 10 '12 at 10:37
I see s019.radikal.ru/i612/1205/ca/ca78b6f561e7.png – Vital May 10 '12 at 10:40

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.