WordPress rewrite rule for specific page and second parametr doesnt work


I have a link like this: https://example.com/page-test/?v=p300 and I created rewrite rule to point new url: https://example.com/page-test/p300/ but it doesnt work.

Just there is redirect to correct website but second parametr “v” is empty.
My code:

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

So first argument pagename is OK and website is redirected to the correct page but second parametr is empty … why ? Or course after the change I save the settings permalinks.

Macsurf 4 months 2022-07-31T05:24:28-05:00 0 Answers 0 views 0

Leave an answer