• Resolved Angelo Rocha

    (@angelorocha)


    I’m using wpdb to identify queries performed on my site’s home page.
    My code is basically this:

    global $wpdb;
    $queries = [];
    $total   = 0;
    foreach($wpdb->queries as $key => $query):
    	$queries[] = [
    		'query' => $query[0],
    		'start' => number_format_i18n($query[1], 4),
    		'end'   => $query[3],
    		'rows'  => count($wpdb->get_results($query[0], ARRAY_A)),
    		'stack' => explode(',', $query[2]),
    	];
    	$total     += $query[1];
    endforeach;
    
    var_dump($queries);

    It works fine, I can see the queries made for the homepage. But there’s one thing I can’t do, what query monitor does, identify which plugins are doing these queries.

    I would like to know if this is something unique to the query monitor or if there is any wordpress functionality that can show which plugins are doing these queries.

    Thanks.

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How query monitor identifies queries made by plugins?’ is closed to new replies.