0

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:

http://mysite.dev/product-category/term1/term-children-1/term2.

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

Thanks

3
  • 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, 2017 at 20:14
  • Hi Tom. What do you mean by 'using WP Admin AJAX'? Jul 19, 2017 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, 2017 at 10:31

1 Answer 1

0

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

https://www.bloggersignal.com/stop-wordpress-from-guessing-urls/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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