Support

Search results for ""

Sorry, no results found. Perhaps you would like to search the documentation?
All Topics
Mark

Custom Field Date Pagination Error

My site is running WordPress 4.9.1 using Admin Columns Pro 4.1.1.

I’m having an issue when I sort my “Items” post type by my custom date field called “Item Date”. The columns are sorting properly by the date, the issue is with the pagination. I can successfully click on the forward and backward arrows to navigate between each page list of items one by one, but if I go try to manually go from page 1 to say page 3 or page 12 (by typing the number in the pagination navigation bar) the columns returns a blank list of items. This is only happening when I have the columns sorted by my custom date field. If I reset sorting and sort by anything else, the pagination works fine.

We only have 1 function on the backend that’s doing any customization to the admin columns and when I remove that function I’m still getting the error. I also turned off everything that I possibly could on my theme’s function file and disabled plugins to try and fix the issue, but it was still happening. So I don’t believe that there’s anything in my theme or plugins that are causing the issue.

I may or may not have a solution, but I’m not sure why this works or what is causing this. After I type in a number in the pagination navigation bar and hit enter, I notice that the URL returns several parameters as listed below:

?orderby=column-meta&order=asc&s&post_status=all&post_type=item_archive&action=-1&m=0&_ac_nonce=****&layout&paged=12&action2=-1

Most of these parameters make sense to be here, but I wasn’t sure what some of theme were doing in this instance. So, I started removing parameters from the URL one by one and found that if I remove &s from the parameter string and then run the URL… the list of items returns successfully. So basically run the URL like so:

?orderby=column-meta&order=asc&post_status=all&post_type=item_archive&action=-1&m=0&_ac_nonce=****&layout&paged=12&action2=-1

It’s very strange and I’m not sure why that allows the query to run successfully since the s parameter is typically used as WordPress’ default search parameter and really shouldn’t affect the column queries. Is it possible that there’s a bug in the plugin that’s conflicting with the pagination? Or is there any other reason you can think that my custom date field would be messing up the pagination?

3 years, 8 months ago
Stefan
Developer

Hi Mark,

Thanks for the detailed explanation of your issue. Can you try to create another custom field column and see if this also gives you the same issue when you change the params in the URL after sorting on that field?

It’s indeed strange that when you remove the search ‘s’ parameter from the URL that it works as expected. But I suspect that there is another plugin/function that alters the WP_Query based on this search param. Do you have any other plugin that does something with search? I think it’s still the first thing we should figure out before we look any further.

3 years, 8 months ago
Mark

Sorry I never replied back, I never had a change to dig deeper into this issue.

I was finally able to do some more research and found that the conflict is caused by another plugin called “SearchWP”. I guess something must have been cached on my end when I originally tested this because I had tried disabling everything once before with no luck.

Now, I haven’t actually dug into the reason as to why SearchWP is conflict with your Admin Columns plugin so I don’t truly know the root cause. But, seeing as how both plugins are modifying search queries the conflict must be happening deep under the covers somewhere.

We might be able to just delete the SearchWP plugin and be done with it, but if the client still wants this search plugin enabled I’m going to have to dig deeper and find a solution. This might be more of a question for SearchWP, but does Admin Column Pro have a hook somewhere that modifies the search query? Maybe I can use your hook to execute the backend query manually so that SearchWP doesn’t mess with it.

I don’t know, it’s a shot in the dark, any help would be much appreciated! Thanks!

3 years, 7 months ago
Stefan
Developer

Hi Mark,

Thanks for your feedback. I will try to reproduce the issue with SearchWP and see if there is anything we can do on our side to solve this issue. I have to setup an environment with this specific plugin first.

3 years, 7 months ago

You must be logged in to reply to this topic.