rewrites and custom links in page need help with add_rewrite_rule

I have one page with edited permalink, like, I need to send there some values by GET request, so i would like the link looks like /detail/value1/value2/

i added this code in

add_action('init', 'rewrite_rules');  
function rewrite_rules(){
    add_rewrite_tag('%value1%', '([^&]+)');
    add_rewrite_tag('%value2%', '([^&]+)');
    add_rewrite_rule('detail/([^/]*)/([^/]*)/?$','detail/?value1=$matches[1]&value2=$matches[2]', 'top');

but it doesn't work actually, and i can't get which rewrite rule structure i should use to make it works. value1 and value2 was added to wp_query array. may anyone help?


didn't help, also

Answers 1

  • Internal rewrite rules should all point to index.php. You also need to set the proper query vars so that the main query can successfully run, in this case, to query for your detail page.


Related Questions