0

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

What I want to be able to do is pass in a parameter using the URL - ie going to domain.com/test/ would load the same page as domain.com/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.com/test/ by adding ?m=1 like to the end of the URL.

0

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

<a href="http://domain.com/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.

  • I have tried that but wordpress is giving 404 error – uDAY Jul 31 at 14:05
  • Very likely it is unrelated to the url parameter itself. Possibly, the presence of the parameter triggers some php code that has an error. You will use $_GET['m'] to grab the value. – Rob H Jul 31 at 14:47
  • 1
    Hi rob thanks for reply, i have do some study on this topic and found that m= parameter is use for month. Can you help me to add &m=1 parameter in end of url – uDAY Aug 1 at 8:34
0

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']);
    }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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