Skip Navigation

[Resolved] PHP Notice about wpv-api calling is_search, is_home, is_archive incorrectly

This support ticket is created 3 years ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 2 replies, has 2 voices.

Last updated by chrisB-36 3 years ago.

Assisted by: Shane.

Author
Posts
#2282451

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?

#2282839

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Chris,

Thank you for getting in touch.

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.

The plugin can be downloaded at the link below.
http://toolset.com/patches/suppress_notices.php

Please let me know if this helps.
Thanks,
Shane

#2282899

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.