add rerwrite rule

Posted in: Newspaper
Post count: 11

Hello, i need to add some rewrite rules but no one of them is works.

add_action( 'init', 'new_rewrite' );
function new_rewrite()
{
add_rewrite_rule('test-drive(/([^/]+))?(/([^/]+))?/?', 'index.php?page_id=172816&var1=$matches[2]&var2=$matches[4]', 'top');
}

this code works in many themes and sites? why it not works here?
Thanks!

Post count: 22421

Hi,
I’m not sure if this is theme related or WP related. I assume you got the code from here:
http://stackoverflow.com/questions/33474523/add-rewrite-rule-ignored-even-with-regex-set-to
Try to add the code in functions.php and then re-save permalinks as the topic suggests.
Thank you!

Viewing 2 posts - 1 through 2 (of 2 total)
The forum ‘Newspaper’ is closed to new topics and replies.