php - wordpress method GET adress bar rewrite

admin2025-06-03  3

I'm submitting a form via method GET on a custom wordpress page using the verbosa theme. Everything works fine except that the GET values are shown in the address bar as seen below.

;go=

I would like it to look like when I use rewritten URL to query the page where it looks like.

My rewrite rules for the GET request look as follows...

add_rewrite_rule(
    '^custom_page/([^/]*)/([^/]*)/?',
    'index.php?page_id=731&search=$matches[1]&id=$matches[2]',
    'top'
);

add_rewrite_rule(
    'custom_page/([^/]*)', 
    'index.php?page_id=731&search=$matches[1]',
    'top'
);

I use two because sometimes only one of the values is present and it didn't work otherwise.

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1748923033a314850.html

最新回复(0)