Hi @emilracerbil,
Thanks for the heads-up. I’ll have a look as soon as I can.
Hey @emilracerbil,
So I just tried this out, went to WP Dashboard > Posts then checked my debug.log file and didn’t find any warning messages related to the WPP Sortable Columns plugin. Even tried sorting posts by views count and got the same result, nothing came up in the log.
My setup:
- WordPress 6.1.1
- PHP 8.1.0
- Active plugins: WordPress Popular Posts 6.1.1 and WordPress Popular Posts Sortable Columns 1.0.1
Anything else I should try to reproduce the issue?
Hi again!
Thanks for such a quick reply! I did some further testing and it seems to only be showing up with Elementor activated.
Maybe thats their problem then? 🙂
I had 3 of the same warnings with all plugins activated.
One warning was showing up with only Elementor activated.
With only Advanced Ads activated, 2 of the same warnings show up.
Perhaps Elementor is altering the $wp_query->query property in some way on the Posts list screen? That’s the only thing from your warning message that would trigger that array offset warning, and Elementor seems to be changing it to null for some reason? Might be worth a shot to reach out to their support team and see what they have to say about it.
From my side I can put in an additional check to make sure that $wp_query->query is an array, that’ll make the warning error go away but then chances are you won’t be able to sort posts by views count as the underlying issue –$wp_query->query being null instead of an array as expected- will still be there.
Alright, thanks for the help! I’ll see if i can get any useful information from them 🙂
Hey @emilracerbil, I also was able to confirm that Elementor is indeed the cause of these warning messages so thanks for the tip.
I just went and updated the script to add that is-this-an-array check I mentioned above. It fixed the warning error for me and the Views column is still working as intended so please grab the latest revision from Github and update your copy accordingly.
I don’t think it’s necessary to contact the Elementor team over this since my patch fixed the problem and everything seems to be fine, however it may be still a good idea to report the problem as their plugin is introducing some unexpected bugs into WordPress’ main query, like this one.