I have added extra rewrite rules for pages with no item_width
and item_height
in combination with pagination as follows:
/**
* Adds rewrite rules for shop category
*/
function gtp_add_shop_rewrite_rules() {
// shop-category/category/item_width/item_height/page/2/
add_rewrite_rule( '^shop-category\/([^/]*)\/([^/]*)\/([^/]*)\/page\/([0-9]*)$', 'index.php?shop-category=$matches[1]&item_width=$matches[2]&item_height=$matches[3]&paged=$matches[4]', 'top' );
// shop-category/category/page/2/
add_rewrite_rule( '^shop-category\/([^/]*)\/page\/([0-9]*)$', 'index.php?shop-category=$matches[1]&paged=$matches[2]', 'top' );
// /shop-category/category/item_width/item_height/
add_rewrite_rule( '^shop-category\/([^/]*)\/([^/]*)\/([^/]*)$', 'index.php?shop-category=$matches[1]&item_width=$matches[2]&item_height=$matches[3]', 'top' );
// /shop-category/category/item_width/
add_rewrite_rule( '^shop-category\/([^/]*)\/([^/]*)$', 'index.php?shop-category=$matches[1]&item_width=$matches[2]', 'top' );
}
add_action( 'init', 'gtp_add_shop_rewrite_rules', 10, 0 );