I have a rewrite rule in my functions.php
which is working just fine.
function custom_offers_rewrite() {
add_rewrite_rule('^offers/([a-z-_]+)/?', 'index.php?page_id=1948&offer_restaurant=$matches[1]', 'top');
}
This looks for anything like /offers/my-custom-path
and then loads in a specific page template / ID (page_id=1948). This template displays some custom things and we're all good.
Whilst that's fine, I have a literal page on the URL path, /offers/all
and I would like to exclude this from the rewrite rule.
Is this possible at all?
So, in other words, if we hit /offers/all
, just ignore the rule and carry on as normal. If anything else, do the rule as it currently works.
I suppose it needs some adjustment to the Regex, but I'm barely any good at pattern matching.
Help and advice appreciated. Many thanks!