On this page
wpdb::log_query( string $query, float $query_time, string $query_callstack, float $query_start, array $query_data )
Logs query data.
Parameters
$querystring Required-
The query's SQL.
$query_timefloat Required-
Total time spent on the query, in seconds.
$query_callstackstring Required-
Comma-separated list of the calling functions.
$query_startfloat Required-
Unix timestamp of the time at the start of the query.
$query_dataarray Required-
Custom query data.
Source
File: wp-includes/class-wpdb.php. View all references
public function log_query( $query, $query_time, $query_callstack, $query_start, $query_data ) {
/**
* Filters the custom data to log alongside a query.
*
* Caution should be used when modifying any of this data, it is recommended that any additional
* information you need to store about a query be added as a new associative array element.
*
* @since 5.3.0
*
* @param array $query_data Custom query data.
* @param string $query The query's SQL.
* @param float $query_time Total time spent on the query, in seconds.
* @param string $query_callstack Comma-separated list of the calling functions.
* @param float $query_start Unix timestamp of the time at the start of the query.
*/
$query_data = apply_filters( 'log_query_custom_data', $query_data, $query, $query_time, $query_callstack, $query_start );
$this->queries[] = array(
$query,
$query_time,
$query_callstack,
$query_start,
$query_data,
);
}
Hooks
- apply_filters( 'log_query_custom_data',
array $query_data ,string $query ,float $query_time ,string $query_callstack ,float $query_start ) -
Filters the custom data to log alongside a query.
Related
Uses
| Uses | Description |
|---|---|
| apply_filters() wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
Used By
| Used By | Description |
|---|---|
| wpdb::_do_query() wp-includes/class-wpdb.php | Internal function to perform the mysql_query() call. |
Changelog
| Version | Description |
|---|---|
| 5.3.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wpdb/log_query