I am trying to eliminate PHP Notice errors from the WordPress doing_it_wrong function that checks for incorrect function calls. For every page request to my site, there are 3 PHP Notice errors logged to my debug.log and after doing a debug trace, I narrowed it down to a Toolset file as the source.
Here's a sample of the Notice error:
PHP Notice: is_archive was called incorrectly. Conditional query tags do not work before the query is run. Before then, they always return false.
There is one PHP notice entry in the log for is_archive, is_home and is_search on every page request to my site.
The debug trace points to lines 359-361 of the /toolset-blocks/embedded/inc/wpv-api.php file as called by /toolset-blocks/embedded/inc/wpv-archive-loop.php line 2138.
It appears there's a bug in the wpv-api.php code that is causing these PHP Notice errors.
While this is just a notice and does not cause an issue on the front end for users, it is filling my debug logfile and making it difficult for me to troubleshoot and debug other issues that are causing problems on my site.
Can you let me know if this is an issue that can and will be fixed within Toolset?
This is a known issue and has already been escalated to our development team. We currently do have a small workaround that you can add to your mu-plugins folder at wp-content/mu-plugins that will suppress the notices.
That workaround is a brute force tactic that suppresses the notices for ALL plugin and theme code. It's not specific to the problem Toolset is causing. So, unfortunately, this doesn't help my situation.
The point of having Debug ON is to see these notices that represent potential problems in my code or other plugins I'm using. The problem here is that Toolset has a known bug that is flooding the debug.log with notices every time a page is requested. This makes it difficult to find other issues by monitoring the log.
Please keep us posted with an ETA for the Toolset fix.