Sunday, July 31, 2022
HomeWordPress DevelopmentWordpress rewrite rule for particular web page and second parametr doesnt work

WordPress rewrite rule for particular web page and second parametr doesnt work


I’ve a hyperlink like this: https://instance.com/page-test/?v=p300 and I created rewrite rule to level new url: https://instance.com/page-test/p300/ nevertheless it doesnt work.

Simply there’s redirect to right web site however second parametr “v” is empty.
My code:

add_action('init', 'add_test_url');
perform add_test_url() {
    add_rewrite_rule('^page-test/([^/]+)/?$', 'index.php?pagename=page-test&v=p300', 'prime');
}

So first argument pagename is OK and web site is redirected to the right web page however second parametr is empty … why ? Or course after the change I save the settings permalinks.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments