QNimate

  • CoursesVideos
  • WP PremiumPlugins
  • DemosLab
  • BlockClusterBuild Private Blockchains
  • Home
  • QIdea
  • QTrack
Home Home Retrieve MySQL Queries Programatically in WordPress

Retrieve MySQL Queries Programatically in WordPress

You can retrieve the list of executed MySQL queries programatically in WordPress to analyse or display them.

First you need to place the below code in wp-config.php file so that WordPress allows you to do so.

define('SAVEQUERIES', true);

Now using the below PHP code you can retrieve the list of queries

<?php

global $wpdb;
$queries = $wpdb->queries; //$queries stores all the queries.
Feb 4, 2015Narayan Prusty
WordPress Change Empty Trash IntervalHashing using Web Cryptography API
Comments: 1
  1. Arkaprava Majumder
    4 years ago

    Small trick but very useful.

    ReplyCancel

Leave a Reply Cancel reply

To create code blocks or other preformatted text, indent by four spaces:

    This will be displayed in a monospaced font. The first four
    spaces will be stripped off, but all other whitespace
    will be preserved.
    
    Markdown is turned off in code blocks:
     [This is not a link](http://example.com)

To create not a block, but an inline code span, use backticks:

Here is some inline `code`.

Narayan Prusty

I am a full-stack web developer. I specialize in Blockchain and JavaScript. This is my personal blog where I write about programming and technologies that I learn and feel interesting to share.

4 years ago 1 Comment WordPress
Share this
0
GooglePlus
0
Facebook
0
Twitter
0
Linkedin
Related Articles
  • WordPress $notoptions Array
  • Add Select Tag using WordPress Settings API
  • wp_load_alloptions() Function
  • Storing Key Value Pairs in CSV using PHP
  • File Upload using WordPress Settings API
Our Sponsor
Freelance: I am available
@narayanprusty
Hi, I am a full-stack developer - focusing on JavaScript, WordPress, Blockchain, DevOps, Serverless and Cordova. You can outsource your app development to me.





Will get back to you soon!!!
WordPress
ReactJS
Meteor
Blockchain
Serverless
Kubernetes
DevOps
DB & Storage
Ejabberd
Let's get started
My Books

2014 - 2015 © QNimate
All tutorials MIT license