Here’s a quick and easy way to identify WordPress mySQL queries per page load.
1. Add the following statemnet to yout wp-config.php
[code]define(‘SAVEQUERIES’, true); [/code]
2. No add this in your wordpress theme footer.php or somewhere near the end of the wordpress loop.
[code]
<?php
if (current_user_can(‘administrator’)){
global $wpdb;
echo "<pre>";
print_r($wpdb->queries);
echo "</pre>";
}
?>[/code]
Neat ways to use this:
- Add this before installing pluggins, so you can see how many mySQL queries they add once activated.
- Use the php script to identify how many mySQL database queries your theme is using
Be sure to disable “savequeries” when you’re done testing your wordpress database usage.