I am using ajax to filter taxonomy archive's results by multiple terms. The "initial" url is http://mysite.dev/product-categoty/term1/

I do update the URL struture on ajax response to something like: http://mysite.dev/product-category/term1/?my_prefix_product_category=term2

If i access the url above directly, WP will rewrite it to:


Is there any way to prevent this from happen for this specific pattern?


  • Have you considered using WP Admin AJAX or better yet the REST API rather than hacking AJAX responses into your template? – Tom J Nowell Jul 19 '17 at 20:14
  • Hi Tom. What do you mean by 'using WP Admin AJAX'? – Bruno Rodrigues Jul 19 '17 at 20:27
  • there's a dedicated API for AJAX, you shouldn't need to hack AJAX into a template via URL parameters codex.wordpress.org/AJAX_in_Plugins although I'd recommend using the REST API to fetch data instead – Tom J Nowell Jul 20 '17 at 10:31

The website below gives you some know how in how you can managed to achieve what you want.


| improve this answer | |

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.