Site icon Hip-Hop Website Design and Development

Multisite customized rewrite urls

On a multisite set up, which is working the Polylang plugin, I need to add a customized rewrite rule.

Presently, my permalink construction is:

http://host.com/sitename/language/pagename

Now I need to add a querystring known as nation, as such:

http://host.com/sitename/nation/language/pagename

I’ve tried the next, however to no avail:

perform custom_rewrite_basic() {
  add_rewrite_tag('%nation%', '([^&]+)');
  add_rewrite_rule('^([a-z]+)/?', 'index.php?nation=$matches[1]', 'prime');
}
add_action('init', 'custom_rewrite_basic');

Any ideas?

— EDIT

Getting nearer, however nonetheless not there:

add_rewrite_tag('%nation%', '([^&]+)');
add_rewrite_tag('%lang%', '([^&]+)');
add_rewrite_rule('^([^/]*)/([^/]*)/?','index.php?nation=$matches[1]&lang=$matches[2]','prime');

The issue right here is that: