Monday, May 18, 2015

How to create custom (Taxonomy) Category for custom post in WordPress

To create custom taxonomy (category) for the custom post type
Final code is  you need to add in the  function.php
Is  here 

add_action( 'init', 'create_book_tax' );

function create_book_tax() {
                register_taxonomy(
                                'photo',    // it is category type
                                'my_photo',
                                array(
                                                'label' => __( 'Competitions' ) ,  // category label
                                                'rewrite' => array( 'slug' => 'Competitions' ), 
                                                'hierarchical' => true,
                                )
                );
}


No comments:

Post a Comment