I have a post type called "shop" and added query variables and a rewrite rule.
// Adds query vars for shop post type
function gtp_add_shop_query_vars( $vars ) {
$vars[] = 'shop-category';
$vars[] = 'width';
$vars[] = 'height';
return $vars;
}
add_filter( 'query_vars', 'gtp_add_shop_query_vars' );
// Adds rewrite rules for shop post type
function gtp_add_shop_rewrite_rules() {
add_rewrite_rule( '^shop/([^/]*)/([^/]*)/([^/]*)$', 'index.php?shop-category=$matches[1]&width=$matches[2]&height=$matches[3]', 'top' );
}
add_action('init', 'gtp_add_shop_rewrite_rules', 10, 0);
With this rules I can visit now:
https://www.example.com/shop/product/80cm/100cm/
But if I want to visit:
the regex does not match anymore and the page will not be found.
What do I need to do to be able to enter all the levels of the url?