• Resolved jenvander

    (@jenvander)


    Any help to get me debugging in the right direction is greatly appreciated!

    This error has not occurred for me before, so I’m wondering if it was a recent update to WordPress (6.1.1) that might be at issue. It’s happening on 6.1.1 with my plugin code, but my plugin had no such warnings on prior versions.

    I am getting the following warnings:

    Warning: array_filter() expects parameter 1 to be array, null given in /home/customer/www/davidg472.sg-host.com/public_html/wp-includes/class-wp-query.php on line 3590
    Warning: array_map(): Expected parameter 2 to be an array, null given in /home/customer/www/davidg472.sg-host.com/public_html/wp-includes/class-wp-query.php on line 3596

    This happens on the Pages page in wp-admin, which is very strange, because my plugin shouldn’t be doing any admin actions that would affect that page.

    I looked at the WordPress code mentioned in the warnings, and for some reason, $this->posts is coming up null. I’m seeing all the pages that I would expect, but I also don’t know which post type this warning is coming from. My plugin’s custom post type is populated with posts, but even if it didn’t have any yet, that would be a valid state.

    I turned on debugging, but it’s not giving me any errors from any file except class-wp-query.php.

    Anyone have any ideas on what could be happening, or where I should look in my code? WordPress hooks that could be getting called on the Pages page that I didn’t realize were called there? I can give you a list of all the hooks I current utilize, if that helps. Just let me know.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Moderator t-p

    (@t-p)

    This may be a plugin or theme conflict. Please attempt to disable all plugins, and use one of the default (Twenty*) themes. If the problem goes away, enable them one by one to identify the source of your troubles.

    ____

    If you can install plugins, install and activate “Health Check”: <a href=”https://ww.wp.xz.cn/plugins/health-check/”>https://ww.wp.xz.cn/plugins/health-check/</a&gt; It will add some additional features under the menu item under Tools > Site Health. On its troubleshooting tab, you can Enable Troubleshooting Mode. This will disable all plugins, switch to a standard WordPress theme (if available), allow you to turn your plugins on and off and switch between themes, &lt;strong>without affecting normal visitors to your site&lt;/strong>. This allows you to test for various compatibility issues. There’s a more detailed description about how to use the Health Check plugin and its Troubleshooting Mode at <a href=”https://make.ww.wp.xz.cn/support/handbook/appendix/troubleshooting-using-the-health-check/”>https://make.ww.wp.xz.cn/support/handbook/appendix/troubleshooting-using-the-health-check/</a&gt;

    Thread Starter jenvander

    (@jenvander)

    Please re-read my post. I know exactly which plugin is causing the issue; it’s mine. I wrote it. My plugin was working without issues with previous versions of WordPress. These warnings appeared with version 6.1.1. I posted this in “Developing with WordPress” because I’m developing with WordPress, and that seemed like the right match.

    Moderator t-p

    (@t-p)

    it’s mine. I wrote it.

    Custom plugins/themes are not supported in these forums.

    Thread Starter jenvander

    (@jenvander)

    Well, I understand your response, however, I’m not convinced that the problem really is my plugin. I think the problem is in WordPress, because everything was fine before the recent upgrade to 6.1.1. Now I’m getting errors in a WordPress PHP file, but I don’t think the problem is with my plugin. I think I’m doing things correctly, but there is a problem in the recent WordPress update that my plugin has tickled. All I’m asking for is a just a few hints, such as which hooks might be running on that wp-admin Pages page, because *nothing* in my plugin should be running in that page at all, so I think that’s yet another hint that something’s going wrong in the recent WordPress update. If you can give me a link to a page that tells me everything that WordPress does when it loads the wp-admin Pages page, that could help a lot.

    Thread Starter jenvander

    (@jenvander)

    Well, I found the hooks being called the hard way, and it does seem there was a WordPress update within the past few months that caused this warning to appear. Anyway, I found a workaround.

    Moderator t-p

    (@t-p)

    Glad its sorted 🙂

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Started getting warnings in class-wp-query.php’ is closed to new replies.