0

I have a Projects page where I use query strings to deep-link to different categories using JavaScript. For example if my URL is www.mysite.com/projects/?theme=blue then I read this query string in JavaScript and load the results using Ajax. I'm only reading the query string in JavaScript, not PHP/WordPress.

The problem is one of my query parameters is named theme, but I also have a custom post type named theme. It's giving me a 404 error any time I have theme in the URL. On just the Projects page, is it possible to tell WordPress not to process any query string variables?

2
  • The usual way to pass parameters with JavaScript is the # symbol, not a query string. Commented Oct 24, 2019 at 11:48
  • I wanted the URLs to be indexable by search engines as well. As far as I know Google doesn't usually index anchor links in URLs. Commented Oct 24, 2019 at 15:37

1 Answer 1

1

Sorry for answering my own question, but I figured it out.

When calling the register_post_type function, the arguments array should set the 'query_var' property to false.

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.