WordPress show SQL queries

To show SQL queries you may add this code to your wp-config.php file:


define('SAVEQUERIES', true);

And add this code to active theme's footer.php file:


<?php

if (current_user_can('administrator')){

    global $wpdb;

    echo "[pre]";

    print_r($wpdb->queries);

    echo "[/pre]";

}

?>

Or you may use one of these plugins:

2 thoughts on “WordPress show SQL queries”

Leave a Comment