N
N
Nikolay2019-02-13 11:33:34
WordPress
Nikolay, 2019-02-13 11:33:34

Why does the redirect rule fire without parameters?

Good day! We have:
1. Rule

add_action('init', function () {
    foreach (['country', 'city'] as $param) add_rewrite_tag('%' .$param . '%', '([^&]+)');
    add_rewrite_rule('^link/([^/]*)/([^/]*)/?', 'index.php?page_id=21&country=$matches[1]&city=$matches[2]', 'top');
}, 10, 0);

2. Links of the type
/link/a/b/
But when you click on the link, redirects to the page/link/

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question