Is there an easy way to see how many queries you make on a page(inside my plugin)? As I dont want to many queries in my plugin.
Leave a Reply
You must be logged in to post a comment.
Is there an easy way to see how many queries you make on a page(inside my plugin)? As I dont want to many queries in my plugin.
You must be logged in to post a comment.
$wpdb
counts the queries ran and saves the value in the$num_queries
class variable.All you need to do is retrieve it:
You may also be interested in the
$queries
class variable.$num_queries
will reflect all queries. Thequeries
variable should have information enough that you can isolate and count only your plugin’s queries, if that is what you want.