add_rewrite_rule with query variables
First of all, Your code does not work because rewrite rules need to be flushed ( function flush_rewrite_rules ), and they need to be flushed for every $id change. Generally this is very bad idea, for performance reasons. You should add rewrite rule only with post_type=product, as You want to pass “p” as $_GET parameter … Read more