We have a section on the site, such as:
for-sale is a WP page, however
category-name is dynamic and is what I wrote the below rewrite rule for.
add_rewrite_rule('for-sale\/([a-z-]+)\/?$', 'index.php?pagename=for-sale&search_slug=$matches', 'top');
However, problems arise when the user needs to use the
page query var, if I try going to:
it get's rewritten to:
So completely strips out the category slug.
Is there a way I can get this to work?
...or preferably I would like to be able to use something like this:
So I tried adding this additional rewrite rule:
add_rewrite_rule('for-sale\/([a-z-]+)\/([0-9])+\/?$', 'index.php?pagename=for-sale&search_slug=$matches&page=$matches', 'top');
..but again, it redirected back to:
What am I missing here?