Categories in custom post types

If you want to use builtin WordPress categories, while calling register_post_type function with taxonomies parameter set to category

If you want to create a custom category, then use register_taxonomy function to register a brand new taxonomy with second parameter to be your custom post type name and pass it taxonomy name to register_post_type as explained above.

A sample would look something like this

$args = array(
    'label' => __( 'Book' ),
    'public' => true,
    'publicly_queryable' => true,
    'show_ui' => true, 
    'show_in_menu' => true, 
    'query_var' => true,
    'rewrite' => array( 'slug' => 'book' ),
    'capability_type' => 'post',
    'has_archive' => true, 
    'hierarchical' => false,
    'menu_position' => null,
    'taxonomies' => array('language'),
    'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'comments' )
  ); 

  register_taxonomy(
        'language',
        'book',
        array(
            'label' => __( 'Language' ),
            'rewrite' => array( 'slug' => 'language' ),
            'hierarchical' => true,
        )
    );
  register_post_type( 'book', $args );

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)