In wordpress I have a custom template in my theme setup for accepting ajax calls. In the wordpress site I have a “page” setup (page path = /ajax/
) to use that template – this gives me an endpoint for javascript to make requests to. In my javascript code I send GET
requests to /ajax/?param1=val1¶m2=val2
, etc.
This works fine except in the case where the value of a parameter is a number. For instance: /ajax/?param1=hello&**param2=12**
In that instance the wordpress site throws a 404 error. It looks like wordpress doesn’t map the url to the page when a parameter value is a number. This also happens when a parameter value starts with a number, so like /ajax/?param1=hello&**param2=5foo**
does the same thing.
Can anyone tell me what is going on here?
Using WordPress 3.0.1
Edit: more info… This appears to be an environment issue. I only have this problem on my dev version of the site which is on dreamhost, but not on the live version of the site which is on 1and1.
dev php version: 5.3.27
live php version: 5.2.17 (doesn’t have the parameter problem)
The problem turned out to have nothing to do with the version of wordpress nor the version of php. One of my query string parameters was named “year”, and when it contained a number, wordpress was matching that parameter up with the %year% token / parameter used to look up blog posts. The solution was to rename the parameter I was using to something else so it didn’t conflict with the query string “year” param that wordpress uses internally.