How to create custom taxonomy?

  • Author
    Posts
  • #85242

    I have been reading a custom taxonomy tutorial and started implementing the same steps that were mentioned but I am not getting the exact display that required. I have pasted this code in functions.php.

    add_action( 'init', 'create_cw_hierarchical_taxonomy', 0 );
    //create a custom taxonomy name
    function create_cw_hierarchical_taxonomy() {
    $labels = array(
    'name' => _x( 'Topics', 'taxonomy general name' ),
    'singular_name' => _x( 'Topic', 'taxonomy singular name' ),
    'search_items' => __( 'Search Topics' ),
    'all_items' => __( 'All Topics' ),
    'parent_item' => __( 'Parent Topic' ),
    'edit_item' => __( 'Edit Topic' ),
    'update_item' => __( 'Update Topic' ),
    'add_new_item' => __( 'Add New Topic' ),
    'new_item_name' => __( 'New Topic Name' ),
    'menu_name' => __( 'Topics' ),
    );
    // taxonomy register
    register_taxonomy('topics',array('post'), array(
    'hierarchical' => true,
    'labels' => $labels,
    'show_ui' => true,
    'show_admin_column' => true,
    'query_var' => true,
    'rewrite' => array( 'slug' => 'topic' ),
    ));
    }
    #85365
    Zed
    Cryout Creations mastermind

    What are you trying to achieve with this custom taxonomy?


    If you like our creations, help us share by rating them on WordPress.org.
    Please check the available documentation and search the forums before starting a topic.
Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘How to create custom taxonomy?’ is closed to new replies.