• Hi all, this is my first post, so please forgive me if I don’t conform to the board norms ??

    I am registering a custom post type using register_post_type. I want this post type to more or less act like a page (e.g. I need to be able to set a theme and assign a parent).

    Here is the call I am making to register_post_type:

    register_post_type('foo', array(
    	'labels' => array(
    		'name' => 'Foo',
    		'singular_name' => 'Foo'
    	),
    	'description' => 'A Foo',
    	'public' => true,
    	'supports' => array(
    		'title', 'editor', 'author', 'page-attributes'
    	),
    	'show_ui' => true,
    	'hierarchical' => true,
    	'menu_position' => 20,
    	'capability_type' => 'page'
    ));

    Now, this works with the exception that the only page attribute I am seeing when I go to add a new post is “order”. I don’t see the “Parent” and “Theme” drop downs like I would with a normal page.

    As you can see above, I specifically set “hierarchical” to true and it was my understanding from the codex that this was all that was required.

Viewing 2 replies - 1 through 2 (of 2 total)
  • drogin, did you ever figure this out? I’m having this same exact issue. WP seems to ignore the attribute altogether displaying only the page order in the admin page.

    It seems like it only works if you make it the first value of the argument array.
    Try:

    register_post_type('foo', array(
    	'hierarchical' => true,
            'labels' => array(
    		'name' => 'Foo',
    		'singular_name' => 'Foo'
    	),
    	'description' => 'A Foo',
    	'public' => true,
    	'supports' => array(
    		'title', 'editor', 'author', 'page-attributes'
    	),
    	'show_ui' => true,
    	'menu_position' => 20,
    	'capability_type' => 'page'
    ));

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘register_post_type, hierarchical not working’ is closed to new replies.