Custom taxonomy archive shows 404 error

Question

Kind a new to wordpress.
Trying to add two new taxonomis to woocommerce:

  • product_color
  • product_category

The taxonomies are added and I see them under products categories, I even can add them to products.

The problem is when I try to enter the archive page.

In the product_category taxonomy every thing works fine, I enter the next uri product_category/asos/ and it works.

The problem happens when I try to enter the product_color archive page in the next uri product_color/red/ and I get 404 page

This is the code I placed in functions.php file.

/**
         * Create custom taxonomy for products
         * product_company
         */    
        function product_company() {
            $labels = array(

                'name'              => _x( 'manufacturer', 'manufacturer' ),
                'singular_name'     => _x( 'manufacturer', 'manufacturer'),
                'search_items'      => __( 'find a new manufacturer' ),
                'all_items'         => __( 'All manufacturers' ),
                'parent_item'       => __( 'category parent' ),
                'parent_item_colon' => __( 'category parent:' ),
                'edit_item'         => __( 'Edit manufacturer' ), 
                'update_item'       => __( 'Edit manufacturer' ),
                'add_new_item'      => __( 'Add a new manufacturer' ),
                'new_item_name'     => __( 'new manufacturer' ),
                'menu_name'         => __( 'יmanufacturers' ),

            );
        
        $args = array(
            'labels' => $labels,
            'hierarchical' => true,
            'query_var' => true,
            'rewrite' => true,
            'show_admin_column' => true,
            'public' => true,
            'show_ui'=> true,
            'show_admin_column '=> true,


        );
        
        register_taxonomy( 'product_category', 'product', $args );
                
    }
    add_action( 'init', 'product_company', 0 );


/**
         * Create custom taxonomy for products
         * product_color
         */    

    function product_color() {
            $labels = array(

                'name'              => _x( 'color', 'color' ),
                'singular_name'     => _x( 'color', 'color' ),
                'search_items'      => __( 'find by color' ),
                'all_items'         => __( 'all colors' ),
                'parent_item'       => __( 'category parent' ),
                'parent_item_colon' => __( 'category parent:' ),
                'edit_item'         => __( 'edit color' ), 
                'update_item'       => __( 'update color' ),
                'add_new_item'      => __( 'add color new' ),
                'new_item_name'     => __( 'new color' ),
                'menu_name'         => __( 'colors' ),

            );
        
        $args = array(
            'labels' => $labels,
            'hierarchical' => false,
            'query_var' => true,
            'rewrite' => true,
            'show_admin_column' => true,
            'public' => true,
            'show_ui'=> true,
            'show_admin_column '=> true,


        );
        
        register_taxonomy( 'product_color', 'product', $args );
                
    }
    add_action( 'init', 'product_color', 0 );
0
DavSev 1 month 0 Answers 7 views 0

Leave an answer