Overnight another team member updated the main blogs to the newest version of WP, and subsequently some plugins we use failed to work correctly.
The plugins display a list of items which are retrieved via an API call to our main database. The plugins offer paging, and when writing these I chose for the AJAX call to be made to the same page, and for the plugin to call the external API, format the items, and just return a block of HTML to be displayed by JS.
When paging, the params passed included ‘page=’ which was working fine before the upgrade. But, eventually, the post-upgrade error was tracked down to the fact that this was being rewritten within WP.
Original HTTP call returned with 301:
http://www.example.com/my-plugin-page?sortby=date&page=2
Redirected to:
http://www.example.com/2/my-plugin-page?sortby=date
The plugin code expects to see a $_GET[‘page’] which was no longer there, paging failed, and page 1 was always displayed no matter which page was being viewed.
In this case, it was easy to rename the ‘page’ param something that wasn’t going to conflict with the rewriting done within WP, but this was an unexpected bug to come up so I thought I’d document it here.
0 Comments.