0

I have this definiton to add a query var:

add_filter( 'query_vars', 'add_reg_query_vars', 10, 1 );
function add_reg_query_vars($vars)
{   
    $vars[] = 'seminar'; //
    return $vars;
}

and this definition to add a rewrite rule:

add_rewrite_rule(
            '^seminare/([a-zA-Z0-9]+?)/([^/]*)/?$',
            'index.php?pagename=seminare/$matches[1]&seminar=$matches[2]',
            'top'
            );

Like this it is working well, links like /seminare/mysite/123/ are matched, but because I have on same page 'seminare' a pagination, I need to exclude the word 'page', that a link like seminare/page/2 is
not matched by my regex above.

Can't get it to work, and honestly I'm not very experienced with the usage of regex. Tried several expressions and when I use for example:

^seminare/(?!page).+?/([^/]*)/?$

or

^seminare/(?!page)([a-zA-Z0-9]+?)/([^/]*)/?$

which matches in reg-tester it doesn't work in wordpress (tested with monkeyman rewrite analyzer). Links like seminare/page/2/ are not matched anymore, that's good, but a link like above like /seminare/mysite/123/ aren't matched anymore as well.

Would be all happy about some assist in that!!!!

1 Answer 1

0

It's not understandable for me, but the second definition works now. No idea, why it didn't work before, but I guess, somewhere I made a small mistake. Sorry, for my useless post ;)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.