Created
August 7, 2018 19:59
-
-
Save bhubbard/470d60e2d05a57dbe362b1b778b7a795 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Default Get Queries | |
* | |
* @access public | |
* @param WP_REST_Request $request | |
* @return void | |
*/ | |
public function get_queries( WP_REST_Request $request ) { | |
global $wpdb; | |
$response = $wpdb->queries; | |
$results = array(); | |
foreach( $wpdb->queries as $query ) { | |
$results[] = array( | |
'query' => $query[0], | |
'time' => $query[1], // TODO: Format | |
'requires' => $query[2] | |
); | |
} | |
// TODO Total Time | |
return rest_ensure_response( $results ); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment