• Resolved nitinsinghal

    (@nitinsinghal)


    Hi

    I am using rewrite_rules_array & it is working fine, until I install this plugin. Please see the ticket below, which is created by me as well:

    https://ww.wp.xz.cn/support/topic/query-parameters-as-slash/

    rewrite_rules_arrayis working fine for me. But with this plugin, it is not.

    I follow the steps mentioned in this ticket above & it is working as expected. Then I install this plugin & just activate it. When I go to http://www.example.com/services/travel it redirects me to http://www.example.com/services/

    Please help!

    • This topic was modified 5 years, 6 months ago by nitinsinghal.
    • This topic was modified 5 years, 6 months ago by nitinsinghal.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Maciej Bis

    (@mbis)

    Could you try the below code snippet? This would make my plugin stop the canonical redirect if your new endpoint is detected as query variable:

    
    function pm_stop_endpoint_redirect() {
    	global $wp_query;
    
    	if(!empty($wp_query->query_vars['services_centers_type'])) {
    		$wp_query->query_vars['do_not_redirect'] = 1;
    	}
    }
    add_action('wp', 'pm_stop_endpoint_redirect');

    Best regards,
    Maciej

    Thread Starter nitinsinghal

    (@nitinsinghal)

    Hi @mbis

    Thanks very much. That worked!

    Regards

    Plugin Author Maciej Bis

    (@mbis)

    Hi @nitinsinghal,

    in the near future, I am going add a separate setting field where it would be possible to stop the redirect for specific custom query variables. Then, the additional snippets will be no longer needed.

    Best regards,
    Maciej

    Thread Starter nitinsinghal

    (@nitinsinghal)

    Yes, that would be great!

    Please try to add that in your next update !

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Query parameters as slash with rewrite_rules_array creating error’ is closed to new replies.