I have a product range with 3 level sub categories. A custom post created named ‘Products’ with a taxonomy ‘product’. following is the code.

function products() {
    register_post_type( 'products',
            'labels' => array(
                'name' => __( 'Products' ),
                'singular_name' => __( 'Product' )
            'public' => true,
            'capability_type'       => 'page',
            'rewrite' => array('slug' => 'products'),
            'supports'      => array( 'title', 'editor', 'thumbnail', 'post-formats', 'excerpt', 'page-attributes'),
add_action( 'init', 'products' );

following is the taxonomy

add_action( 'init', 'create_product_taxonomy' );
function create_product_taxonomy() {
    register_taxonomy('product', 'products',
            'label' => 'Product Of Category',
            'hierarchical' => true,

my product adding structure is following

Commercial Ovan (category 1)
-- Stand Ovan (sub category 1.1)
---- Stand ovan 1 (sub category 1.1.1)
---- Stand ovan 2 (sub category 1.1.2)
-- Without Stand Ovan (sub category 1.2)
---- Without stand ovan 1 (sub category 1.2.1)
---- Without stand ovan 2 (sub category 1.2.1)

I am using a loop on index page of categories. Click on any category will show all sub category and then click on any sub category will show further categories.

Please help me finish this.

Read more here: WordPress custom post taxonomy with 3 level categories


If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Wordpress related questions and answers: