I think I found out now the problem on this error, as well on the top/parent pages causing the error. On my Template function I have a custom rewrite URL, if I remove this and reset the rewrite_rules it works ok, but if I add again it cause error on polylang url structure.
Do you know a way on how on how I can hookup this on polylang which will side by side works ok? Thanks
///// rewrite a new permalink structure s
add_filter('init','flushRules');
add_filter('rewrite_rules_array','wp_insertMyRewriteRules');
function flushRules(){
global $wp_rewrite;
$wp_rewrite->flush_rules();
}
function wp_insertMyRewriteRules($rules){
$mypath = htmlspecialchars(strip_tags(trim($_SERVER["REQUEST_URI"])));
$mypath = preg_replace('/(.*)\?(.*)/', '$1', $mypath);
$urlbit = explode("/",$mypath);
$newrules = array();
$newrules['news/(press-release|in-the-press|case-studies|events|industry-insight)/?$'] = 'index.php?page_id='.NEWSSYSID.'&posttype=$matches[1]';
$newrules['news/(press-release|in-the-press|case-studies|events|industry-insight)/page/([0-9]+)/?$'] = 'index.php?page_id='.NEWSSYSID.'&posttype=$matches[1]&paged=$matches[2]';
$newrules['news/(press-release|in-the-press|case-studies|events|industry-insight)/archive/([0-9]+)/([0-9]+)/?$'] = 'index.php?page_id='.NEWSSYSID.'&posttype=$matches[1]&mm=$matches[3]&year=$matches[2]';
$newrules['news/(press-release|in-the-press|case-studies|events|industry-insight)/archive/([0-9]+)/([0-9]+)/page/([0-9]+)/?$'] = 'index.php?page_id='.NEWSSYSID.'&posttype=$matches[1]&mm=$matches[3]&year=$matches[2]&paged=$matches[4]';
$newrules['news/(press-release|in-the-press|case-studies|events|industry-insight)/archive/([0-9]+)/?$'] = 'index.php?page_id='.NEWSSYSID.'&posttype=$matches[1]&year=$matches[2]';
$newrules['news/(press-release|in-the-press|case-studies|events|industry-insight)/archive/([0-9]+)/page/([0-9]+)/?$'] = 'index.php?page_id='.NEWSSYSID.'&posttype=$matches[1]&year=$matches[2]&paged=$matches[3]';
return $newrules + $rules;
}
add_filter('query_vars', 'add_my_var');
function add_my_var($public_query_vars) {
$public_query_vars[] = 'posttype';
$public_query_vars[] = 'mm';
$public_query_vars[] = 'year';
$public_query_vars[] = 'paged';
return $public_query_vars;
}
///// rewrite a new permalink structure e