I am working on wordpress which is new to me
Now I have been provided with site completely designed in wp
But the problem is I am unable to search the query for each functionality/page
I found
$wpdb->get_results
used for getting result from database
also this is not working
$wpdb->queries
Is there any way to print each query currently executing?.
Please Help.
Debug bar is one of the recommended (by WordPress) plugins to install for theme and plugin development. I also use debug-bar-extender: http://wordpress.org/extend/plugins/debug-bar-extender/
For
$wpdb->queries
to work you need to configure inwp-config.php
:This is highly not recommended for production (heavy performance hit) and so turned off by default.
I often do this when I need to check the current query:
To show the current query, just add
?q
into the current URL.This will show the current query (stored in global variable $wp_query), including the SQL query and all other query variables.
I prefer Debug Bar.
No need to install any plugin, you can use this:
Source: Codex
The global
$wp_query
contains everything about the current query, including the arguments, results, contents of the results, and the query itself.$wp_query->request
should do the job for you here.You could also use the WPDB Profiling plugin that will display all SQL statements that were run to generate the page you’re currently on, at the bottom of the page.
You can use the Wp Pear Debug plugin. It will show you a list of the queries executed in the page, the number of seconds those queries took to execute and the php function which initiated the query. Please note that you must save the settings at least once before it begins working.
Ie.