Possible bug where + is replaced by in querystring when in pagination /page/
-
I discovered a very strange behavior of WP that is present even in a totally stock installation.
I even set up a test site for the purpose of this question.
So, suppose a page where there is some querystring with multiple terms separated by +, like mywordpress.com/sample-page/?param=val1+val2
Now, suppose that this page shows results that span across multiple pages, and you go to page 2. Strangely, the link becomes wordpress.com/sample-page/page/2/?param=val1%20val2
Basically, I discovered that /page/ isn’t even necessary for this strange rewrite/replacement. All that is needed is the /2/, or in general a /d/ where d is a decimal number, part for + to get replaced by %20.
Even more strangely, when the param is the stock “s” used for the default searchbox, + isn’t replaced by %20.
As I said, for the purpose of this question, I setup a totally stock WP site for you to see this in action.
So, if you go here: /test/?s=test+page, you will see the returned results of the terms “test page” (I created 20 of them). So the results span across multiple pages.
Now, if you click on page 2, you are moved to the URL /test/page/2/?s=test+page. This is perfectly fine up to here.
However, if you change the param “s” to something else for the needs of another custom functionality, when you go to /page/2/ there is a rewrite that takes place. Study the following URLs in my test site. They don’t do anything specific, but you will see the redirection in action:
/test/?param=test+page
/test/page/2/?param=test+page
See what is happening? The second URL when loaded replaces the + with a %20 if in Chrome, and with a whitespace char when in any other browser…
Any idea why this is happening? Does it serve any particular functionality or is it just a well hidden bug? Strangely enough, even with the replacement taking place, all terms passed in the querystring are recognized, so it doesn’t break anything up. It just ruins uniformity of the URLs, and it’s driving me crazy…
The page I need help with: [log in to see the link]
- The topic ‘Possible bug where + is replaced by in querystring when in pagination /page/’ is closed to new replies.