Viewing 1 replies (of 1 total)
  • Thread Starter mattloak

    (@mattloak)

    I found the answer in another forum:

    1st Add define('SAVEQUERIES', true); to your wp-config.php

    2nd, add this to your footer:

    <?php if (current_user_can('administrator')){
        global $wpdb;
        echo "<pre>";
        print_r($wpdb->queries);
        echo "</pre>";
    } ?>

    I found another answer that doesn’t involve editing core files but I couldn’t get it to work properly:

    Add this to the functions.php:

    add_filter('posts_request','debug_post_request'); // debugging sql query of a post
    function debug_post_request($sql_text) {
    $GLOBALS['debugku'] = $sql_text; //intercept and store the sql
    return $sql_text;
    }

    and add this to the footer:
    <?php print_r($GLOBALS['debugku']); ?>

Viewing 1 replies (of 1 total)
  • The topic ‘Is there any way to list all the database queries my WP install is making?’ is closed to new replies.