You can paste this block of code in your currently active WordPress theme functions.php
file:
function wpse_footer_db_queries(){
echo '<!-- '.get_num_queries().' queries in '.timer_stop(0).' seconds. -->'.PHP_EOL;
}
add_action('wp_footer', 'wpse_footer_db_queries');
The above block of code, will render an HTML comment in the footer of your theme (before </body>
and </html>
, containing the number of database queries and how log they took to retrieve.
Related Posts:
- Hook directly into query execution
- get_results using wpdb
- Hook into $wpdb
- How to monitor server for error establishing a database connection
- Export wordpress table to excel
- Identify which loop you are hooking into; primary or secondary?
- How to get site URL if database is disconnected?
- How best to inject ads between posts in the loop?
- Change SQL get_results to search for posts with custom term in custom taxonomy
- Hook to be used when creating a database table
- Change all http to https in mysql databse?
- WooCommerce – Query for ordered products
- PHP variable in WordPress database query
- Block search SQL from happening
- Delete duplicate rows from wordpress database where a column is duplicate in phpmyadmin
- Query WordPress database by registered date and role
- Trigger Plugin database update after git pull
- How to prevent WordPress from retrieving data for the last 10 posts in the database?
- Query from a different database than the default
- How to query the WordPress database to get posts of a certain custom post type, taxonomy and field?
- Select Multiple meta_value from WP DB; Single Query
- CRUD operations using WordPress database API
- Where are WP_Errors Saved
- Advanced SELECT query with condtional statements
- Select two sums with single get_var statement
- Replace/Mute/Stop Search Query
- Slow queries constantly getting stuck on WordPress database of ~100,000 posts
- How to Access wp_usermeta Data Immediately After a New User is Created
- cache specific data?
- How to update the values when the featured image has changed?
- How Can I Put Meta_Compare in the Database-Query?
- How to paginate information obtained from a query to a custom table?
- Historic WordPress database connection
- Check if an option exists and get its value in one hit
- Query multiple tables at once?
- Post Views / Hit Counter Problem?
- $wpdb->query can’t insert data
- Custom WordPress Table wpdb
- Best practice to limit results in get_row()?
- How to display content from external db with relevant urls
- how to count click tab menu and insert to database
- Connecting to a different database
- SQL query to set posts in bulk based on the post content
- Query Column of Specific ID from Database Table
- Custom search query by category id
- How to display data from db in select list [closed]
- How can I query the db to access current post information?
- Compare User meta_value with Product meta_value
- How to get the full stack trace for WordPress “table doesn’t exist” error in debug.log?
- How to insert a value to decimal type field using wpdb->prepare?
- Join Query on WP_USERMETA Table
- Insert NULL value using prepare()
- Job and Employee Performance Tracking with Product Safety
- adding user_id and name to a separate table whenever a user register based on role
- WordPress Database Query works in phpMyAdmin but not in the code
- wpdb query to insert images in to post/page gallery
- Set SQL_BIG_SELECTS and MAX_JOIN_SIZE on a WP_Query
- About wp database hooks (error establishing connection)
- Performance bug – slow DB query
- How to optimise this database query?
- How can we speed up wp_get_nav_menu_items()?
- Extracted CSV as Array for Custom Query Loop
- Should I Use only wpdb Class to Write Custom Queries?
- Generating an HTML table from an array based on dynamic key values
- Pulling values from a sepcific row in table
- Using class id from array for query
- Attach posts based on category and position
- database search feature
- SQL Query to get post_id from wp_posts and and meta_key(s) from wp_postmeta
- SQL query to rewrite all media URLs to end with .webp
- How do I find users by password?
- How to disable publish_future_post auto add wp_options cron
- SQL errors when querying for something with apostrophes
- Count views without get_post_meta
- What is recommended data type and encryption type for password in a database
- Unable to login to a https website via the app after changing from http
- $wpdb->insert duplicating rows
- Is there an actual way to synchronize ‘production’ and ‘develop’ WordPress databases?
- Lost database connection
- How to force set same page as homepage and blogpage in static page settings
- mysqli_query(): MySQL server has gone away for Curl Request
- How to get meta key list efficiently?
- How to rerieve comments and their replies from DB
- Inserting data with Geometry field
- Getting values from form and saving in database but spaces are inserted instead of form values
- Troubles when I want to connect to another DB
- Intermittent Yet Problematic Error – “Error Establishing A Database Connection”
- WordPress site migration – locked out of admin area
- Get all top categories, then only 3 posts for each
- Best way to store 1 billion+ posts?
- Having all “non-PHP” files on a different server
- Can I use a wpdb object to connect to a non-WordPress Oracle database [duplicate]
- syntax error for changing user role from database
- Optimize WP site for millions of posts
- Is it safe to add INDEX to a column in WordPress database?
- Count singular post views automatically
- Error establishing a database connection with XAMPP
- is it possible to install new WordPress in an old WordPress folder?
- I Want a More Concice Form of Data than an Array
- Malware in old website – how to migrate?