diff --git a/includes/class-wc-post-types.php b/includes/class-wc-post-types.php index fa2cec29217..41d158dbeb2 100644 --- a/includes/class-wc-post-types.php +++ b/includes/class-wc-post-types.php @@ -209,7 +209,7 @@ class WC_Post_types { ); } } - + do_action( 'woocommerce_after_register_taxonomy' ); } } @@ -262,6 +262,10 @@ class WC_Post_types { ) ); + if ( preg_match( '/\/(.+)(\/%product_cat%)$/' , $product_permalink, $matches ) ) { + add_rewrite_rule( '^' . $matches[1] . '/.+?/[^/]+/([^/]+)/?$', 'index.php?attachment=$matches[1]', 'top' ); + } + register_post_type( "product_variation", apply_filters( 'woocommerce_register_post_type_product_variation', array(