0

Hi I am using an exteral site which redirects to my wordpress site with some url parameters. Unfortunately one of these is m which is causing a conflict which wordpress's native parameters and throwing a 404 not found. is there any I can tell wordpress to ignore that parameter for a specific page?

  • It's better to not use the parameter on the external site. – Nicolai Jan 13 '17 at 13:51
  • Yes that would preferable, but it's not my site, so I need a workaround. – frank astin Jan 13 '17 at 13:59
0

You can filter request and unset m there, which will remove it from the query. This is a simple example that will remove it in all cases, you probably want to narrow the check down with something else, like checking if pagename is also set:

function wpd_request_filter( $request ){
    if( isset( $request['m'] ) ){
        unset( $request['m'] );
    }
    return $request;
}
add_filter( 'request', 'wpd_request_filter' );

You can var_dump( $request ) in the filter to see what it contains for different types of requests.

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.