admin管理员组

文章数量:1417434

I have a WordPress post which is accessible via domain/test/

What I want to be able to do is pass in a parameter using the URL - ie going to domain/test/ would load the same page as domain/test/ - but in url show the /accommodation/value1/?m=1 in the browser address bar.

I guess another way of putting it would be to say I need to be able to access domain/test/ by adding ?m=1 like to the end of the URL.

I have a WordPress post which is accessible via domain/test/

What I want to be able to do is pass in a parameter using the URL - ie going to domain/test/ would load the same page as domain/test/ - but in url show the /accommodation/value1/?m=1 in the browser address bar.

I guess another way of putting it would be to say I need to be able to access domain/test/ by adding ?m=1 like to the end of the URL.

Share Improve this question asked Jul 31, 2019 at 13:01 uDAYuDAY 1
Add a comment  | 

2 Answers 2

Reset to default 0

Typically, you will add the parameter to the URL on a different page. For example:

<a href="http://domain/test?m=1">Details about M1</a>

This is because the parameter affects what the server loads. So you can't go to the URL and then add the parameter after load. That's not what its for.

Thanks for reply

i have tweak my code and its working for me

add_action("init","remove_m_parameter");
function remove_m_parameter()
{
    if(isset($_GET['m']))
    {
    unset($_GET['m']);
    }
}

本文标签: url rewritingPassing parameter through permalink structure