0

Few days ago updated my wordpress(on local host) to 4.8, on update the categories and tags for cpt post which has assigned 'hierarchical=> true' for using 'page-attributes' has stopped displaying on admin panel of wordpress backend even though it has assigned respective tags,cities and categories to individual post.

As we have page-attributes assigned to CPT for which we have set hierarchical as true, making true its showing tags and category columns as blank in admin panel which shows in below image

enter image description here

This used to work well before the update to version 4.8.

we have registered the cpt using belowed code.

function register_post_types(){
$singular = 'Post';
$plural = 'Pages';
register_post_type( 'XXXX', [
'has_archive' => TRUE,
'hierarchical' => true,
'singular_name' => $singular,
'labels' => [
    'name' => 'XXXX'
],
'public' => TRUE,
'supports' => ['editor', 'page-attributes', 'revisions', 'thumbnail', 'title','custom-fields','excerpt'],
'taxonomies' => array('post_tag')
] );
add_image_size( 'YYYY', 650, 650, TRUE );
}
add_action( 'init', __NAMESPACE__.'\register_post_types', 20 );

In the above code we tried changing 'hierarchical' => false, which shows the data in following tags and category columns but on edit individual post the page-attributes option gets changed to post-attributes which disables the parent post.

For example see below image:

enter image description here

As on making hierarchiocal=>false we get post-attributes displayed instead of page-attributes and not showing parent option to select in individual post.

I tried multiple of changes to make it work but no luck!!

Even on googling not got expected results.

Do I need to add something else to make it work?

Thanks a lot for your help !!

0

You havent registered the taxonomy, example of one I use

register_taxonomy( 'location', 
        array('business'), /* if you change the name of register_post_type( 'custom_type', then you have to change this */
        array('hierarchical' => true,     /* if this is true, it acts like categories */             
            'labels' => array(
                'name' => __( 'Locations', 'custom' ), /* name of the custom taxonomy */
                'singular_name' => __( 'location', 'custom' ), /* single taxonomy name */
                'search_items' =>  __( 'Search locations', 'custom' ), /* search title for taxomony */
                'all_items' => __( 'All Locations', 'custom' ), /* all title for taxonomies */
                'parent_item' => __( 'Parent Location ', 'custom' ), /* parent title for taxonomy */
                'parent_item_colon' => __( 'Parent location:', 'custom' ), /* parent taxonomy title */
                'edit_item' => __( 'Edit Custom Category', 'custom' ), /* edit custom taxonomy title */
                'update_item' => __( 'Update Custom Category', 'custom' ), /* update title for taxonomy */
                'add_new_item' => __( 'Add New Custom Category', 'custom' ), /* add new title for taxonomy */
                'new_item_name' => __( 'New Custom Category Name', 'custom' ) /* name title for taxonomy */
            ),
            'show_admin_column' => true, 
            'show_ui' => true,
            'query_var' => true,
            'rewrite' => array( 'slug' => 'location' ),
        )
    );   
  • you can check above i have updated the question, on making hierarchical=> false it works but page-attributes doesnt work on it and we need page-attributes to be work. – Vinit Sinkar Oct 13 '17 at 11:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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