I am using WP 3.2.1.
I try to do permalink like: /en/1/some-string. Structure is: %lang%/%pageID%/%some random string%
So I add a rewrite rule:
function nw_lang_addRewrite($aRules) {
$_aRules["(en|lt|ru)/(d+)(/.*)?$"] = 'index.php?p=$matches[2]&lang=$matches[1]';
$aRules = $_aRules + $aRules;
return $aRules;
}
add a lang tag:
function nw_lang_addQuery($vars) {
$aVars[] = "lang";
return $aVars;
}
Buf if user go to http://www.somesite.com/en/17/2-Pork.html he dont see page with ID = 17.
$wp_query is:
WP_Query Object (
[query_vars] => Array
(
[lang] => en
[error] =>
[m] => 0
[p] => 0
.....
[static] =>
[pagename] =>
[page_id] => 0
[paged] => 0
....
[is_single] =>
[is_preview] =>
[is_page] =>
[is_paged] =>
...
[queried_object] =>
[queried_object_id] => 0
)
I found a problem. I needed change function parameter name to “$aVars”.