I am trying to create custom taxonomy for my custom post. But when i am trying to add new category, a notice like "notice trying to get property of non-object in...." is showing. Here is the code for custom post
  function newsbox_post() {
    register_post_type( 'newsbox-post',
    array(
        'label'               => __( 'Newsbox Post', 'text_domain' ),
        'labels' => array(
            'name' => __( 'Newsbox Posts' ),
            'singular_name' => __( 'Newsbox Post' ),
            'menu_name'    => __( ' Newsbox Post', 'text_domain' ),
            'parent_item_colon'   => __( 'Parent  Newsbox post:', 'text_domain' ),
            'all_items'           => __( 'All  Newsbox post', 'text_domain' ),
            'view_item'           => __( 'View  Newsbox post', 'text_domain' ),
            'add_new_item'        => __( 'Add New  post', 'text_domain' ),
            'add_new'             => __( 'New post', 'text_domain' ),
            'edit_item'           => __( 'Edit post', 'text_domain' ),
            'update_item'         => __( 'Update post', 'text_domain' ),
            'search_items'        => __( 'Search post', 'text_domain' ),
            'not_found'           => __( 'No post found', 'text_domain' ),
            'not_found_in_trash'  => __( 'No post found in Trash', 'text_domain' )
        ),
        'public' => true,
        'rewrite' => array('slug' => 'Newsbox-post'),
        'description'         => __( 'Enter recent to your newsbox', 'text_domain' ),
        'supports'            => array( 'title', 'editor', 'page-attributes' ),
        'show_ui'             => true,
        'show_in_menu'        => true,
        'show_in_nav_menus'   => false,
        'show_in_admin_bar'   => true,
        'can_export'          => false,
        'has_archive'         => false,
        'exclude_from_search' => true,
        'publicly_queryable'  => true,
        'capability_type'     => 'post'
        )
  );
 }
add_action( 'init', 'newsbox_post' );
and here is the code for custom taxonomy
 add_action( 'init', 'newsbox_post_category_taxonomy', 0 );
 function newsbox_post_category_taxonomy() {
 $labels = array(
'name' => _x( 'Categories', 'taxonomy general name' ),
'singular_name' => _x( 'Categories', 'taxonomy singular name' ),
'search_items' =>  __( 'Search Category' ),
'all_items' => __( 'All Categories' ),
'parent_item' => __( 'Parent Category' ),
'parent_item_colon' => __( 'Parent Category:' ),
'edit_item' => __( 'Edit Category' ), 
'update_item' => __( 'Update Category' ),
'add_new_item' => __( 'Add New Category' ),
'new_item_name' => __( 'New Categories Name' ),
'menu_name' => __( 'Categories' ),
 );     
  register_taxonomy('Categories',array('newsbox-post'), array(
    'hierarchical' => true,
    'labels' => $labels,
    'show_ui' => true,
    'show_admin_column' => true,
    'query_var' => true
  ));
  }
Please tell me the solution. Thanks.
 
    