I have a strange problem , I have the following pairs :
add_rewrite_rule('^questions/ask/?','index.php?pagename=ask','top');
if(is_page('ask')){
$tname = 'add-question.php';
if(file_exists(TEMPLATEPATH.'/'.$tname)){
$returntemplate = TEMPLATEPATH.'/'.$tname;
}else{
$returntemplate = $plugindir.'/default-template/'.$tname;
}
ahaali_do_theme_redirect($returntemplate);
and :
add_rewrite_rule('^questions/ed/([^/]*)/?','index.php?pagename=ed&id=$matches[1]','top');
if(is_page('ed')){
$tname = 'edit-question.php';
if(file_exists(TEMPLATEPATH.'/'.$tname)){
$returntemplate = TEMPLATEPATH.'/'.$tname;
}else{
$returntemplate = $plugindir.'/default-template/'.$tname;
}
ahaali_do_theme_redirect($returntemplate);
}
Now what happens is the following : the first rule and template redirect works while the second one does not I have added in the header of my theme
print_r($wp->query_vars);
the result is :
Array ( [pagename] => ed [id] => 10 )
so the rule itself works but the template redirect does not , any idea ?
Thanks !