Possible Bug with Query Monitor Plugin?

Just tried to install Query Monitor – WordPress-Plugin | WordPress.org Deutsch on a site together with L&L, but for some reason query monitor throws a fatal error as soon as both of the plugins are activated. When i deactivate L&L everything works again. Is this a known bug or idid anyone else experience the same behaviour?

Hmm, you’re right, when I install Query Monitor I get a fatal error when I try to activate or deactivate either plugin. The error message I’m getting seems to be coming from the Query Monitor side of things though:

Fatal error: Uncaught Error: preg_split() expects parameter 2 to be string, integer given in \wp-content\plugins\query-monitor\classes\Hook.php on line 65

Is that the same error you’re getting? I’m not a dev, but it seems like this might be something that would need to be solved by Query Monitor. The support on their repo page you linked looks pretty responsive though, so it seems like posting on there might be your best bet. Let me know how that goes and if that doesn’t work out, let me know and I’ll see what we can do!

Hi @benjamin and thank you very much for your reply. I opened a ticket at the other plugin’s support page. I’ll keep you updated.

Not sure if i should create a new forum post for this, but the reason I wanted to investigate the queries with the plugin is that I tried to use L&L templates within this plugin: https://wpgridbuilder.com/ . Basically it is something like an Elementor or Beaver Builder post widget or Facet WP. However, the problem is that the template does not use the correct post ID.

From other forum posts I have seen that this should work with Get local variable and it does. But the problem is that this way I have to use the template in combination with a loop tag and this causes unnecessary database queries.

This is my current setup:

Template:
<Loop type=post id="{Get local=post_ids}">

Used shortcode within WP Grid Builder
[template id=824 post_ids={{post.id}}]

Is there any way to accomplish this without the loop tag?

I have just received a reply from the developer of Query Monitor. According to him, an invalid hook name within L&L is the cause of the problem. Here is the full answer:

Thanks for the report! The cause here is the Tangible Loops and Logic plugin is triggering an action with an invalid hook name. The hook name appears to be boolean false, which internally gets converted to integer zero by the WordPress hook system, and this is what gets passed onto QM and causes the fatal error. A hook name must be a string, and anything such as boolean false is not going to work and needs to be fixed.

You should report this to the developers of the Loops and Logic plugin. The problematic code is here: https://plugins.trac.wordpress.org/browser/tangible-loops-and-logic/tags/3.1.1/vendor/tangible/plugin-framework/tangible-module.php?marks=173#L173 . The value of $this->ready at this point is boolean false.

Nice, glad they were able to clear that up! I’ll pass this along to a dev to get this addressed and I’ll follow up in this thread when the issue has been resolved.

Glad to hear your workaround gets your template working, but you’re right that that’s not ideal. In theory, you wouldn’t need to set a local variable and then add a loop to pass the right context to your L&L template. L&L should be able to understand what the “current” post is and be able to get fields and context from that post. It seems that with a few plugins, like WPGridBuilder in your case, that context isn’t getting through so L&L isn’t quite sure where to get data from the current post. Are you using the standalone WP Grid Builder plugin or are you using it through its add-on for Elementor or Beaver Builder?

Thanks for your assistance Benjamin, appreciate it.

Regarding WP Grid Builder:
I usually use it in combination with Elementor, but just tried it with a Gutenberg only site. Unfortunately with the same result. It only works with a local variable and a loop tag.