• Resolved adielbm

    (@adiel987654554)


    I wanted to have a permalink that would display products from a specific category that belong to the same brand: something like this:

    example.com/brand/brand-name/category/category-name/

    So what I was thinking of doing is what is in the code I wrote:

    function brand_rewrite_rule() {
        add_rewrite_rule( '^brand/([^/]*)/category/([^/]*)/?', 'index.php?pwb-brand=$matches[1]&product_cat=$matches[2]', 'top');
    }
    
    add_action('init', 'brand_rewrite_rule', 10, 0);

    And it works great.
    The only problem is in the pagination, going to page 2 he presents the same products, of the first page, at this link:
    example.com/brand/brand-name/category/category-name/page/2/

    Thanks!

The topic ‘permalink for product category’ is closed to new replies.