• Resolved isak84

    (@isak84)


    Hi. My CPT Producer don’t show the option to assign parents. Any idea how to fix this?

    <?php
    
    register_post_type(
    	'producer',
    	array(
    		'labels'			 => array(
    			'name'			 => 'Producent',
    		),
    		'description'        => 'Fairtrade producenter.',
    		'public'             => true,
    		'publicly_queryable' => true,
    		'show_ui'            => true,
    		'show_in_menu'       => true,
    		'query_var'          => true,
    		'rewrite'            => array( 'slug' => 'fair_producer' ),
    		'capability_type'    => 'post',
    		'menu_icon'			 => 'dashicons-exerpt-view',
    		'has_archive'        => true,
    		'hierarchical'       => true,
    		'menu_position'      => 26,
            'taxonomies'         => array( 'category' ),
    		'supports'           => array( 'title', 'editor', 'thumbnail', 'category', 'excerpt', 'page-attributes' )
    	)
    );
    
    register_taxonomy(
    	'producer_category',
    	array( 'producer' ),
    	array(
    		'hierarchical'		 => true,
    		'labels'			 => array(
    			'name'			 => 'Kategorier',
    			'singular_name'	 => 'Kategori',
    			'menu_name'		 => 'Kategorier',
    		),
    		'show_ui'			 => true,
    		'show_admin_column'	 => true,
    		'query_var'			 => true,
    		'rewrite'			 => array( 'slug' => 'producentkategori' ),
    	)
    );
Viewing 1 replies (of 1 total)
  • Thread Starter isak84

    (@isak84)

    I copied this solution:

    $args = array(
                'hierarchical' => true,
                'labels' => $labels,
                'public' => true,
                'publicly_queryable' => true,
                'show_ui' => true,
                'show_in_menu' => true,
                'query_var' => true,
                'rewrite' => true,
                'capability_type' => 'page',
                'has_archive' => false,
                'menu_position' => 22,
                'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'revisions', 'page-attributes', 'custom-fields' )
            );

    And when I removed my old producers and made new ones, the parent option suddenly appeared.

Viewing 1 replies (of 1 total)
  • The topic ‘Hierarchical CPT’ is closed to new replies.