You only have one capture group, the ID is in matches[1]
, there is no matches[2]
.
EDIT-
Here is the working version I tested in the 2016 theme. I created a page with slug sign-up
, added the following to functions.php
, then visited the Permalinks Settings page to flush rewrite rules. The value passed to product
is available in the template via get_query_var( 'product' );
function wpd_product_rewrite() {
add_rewrite_tag( '%product%', '([0-9/]+)' );
add_rewrite_rule(
'^sign-up/product/([0-9/]+)?$',
'index.php?pagename=sign-up&product=$matches[1]',
'top'
);
}
add_action( 'init', 'wpd_product_rewrite' );