query-monitor
query-monitor copied to clipboard
Is it possible for a link to open the Query Monitor panel from outside QM?
I apologize that this is more of a "discussion" type post than an issue, but I've experimented in code and searched the docs and issues and it does not appear that this has been asked before.
My theme provides some background information about the server in a Dashboard metabox, but I'd like to add a conditional to see if Query Monitor is active, and if so, link to the Environment panel inside of the QM drawer for additional information.
The first thing I tried was simply adding the following link (same as the link in the QM Admin Bar):
<a href="#qm-environment">Additional Server Information (Query Monitor)</a>
But when clicked, nothing happens.
I started looking through the QM JavaScript files, but I didn't want to get too complicated to have to monitor/maintain it. If it isn't possible with a fairly simple link that isn't a big deal, but I thought I'd ask in case that functionality does already exist.
Thanks!
Those anchor links are remnants from how QM used to work, they don't do anything now.
The short answer is I don't think this is possible. The function you want is show_panel()
but it's defined within an anonymous function as a callback to jQuery( function($) { ... } )
so there's no way to access it outside of this scope.
Ok no problem– thanks for the clarification!