admin管理员组

文章数量:1130349

Not sure if I've done something incorrectly here, but I have the following rewrite rule;

    add_rewrite_rule(
    '^product/([0-9]+)/([^/]+)/?$',
    'index.php?name=productl&id=$matches[1]',
    'top'
);

Which seems to work; so if I visit the following URL

mysite/product/23/product-description-goes-here

a page loads. However, because the wordpress permalinks are enabled, it then seems to be getting rewritten again (?) to be the post title. So the resulting URL in my address bar is

mysite/product/ 

this of course is breaking the page as the id is no longer in the URL. How can I have it maintain my original URL and not rewrite it to be the pages post title?

Not sure if I've done something incorrectly here, but I have the following rewrite rule;

    add_rewrite_rule(
    '^product/([0-9]+)/([^/]+)/?$',
    'index.php?name=productl&id=$matches[1]',
    'top'
);

Which seems to work; so if I visit the following URL

mysite/product/23/product-description-goes-here

a page loads. However, because the wordpress permalinks are enabled, it then seems to be getting rewritten again (?) to be the post title. So the resulting URL in my address bar is

mysite/product/ 

this of course is breaking the page as the id is no longer in the URL. How can I have it maintain my original URL and not rewrite it to be the pages post title?

本文标签: url rewritingIssue with custom rewrite for products and permalinks