Or, colleague. Need to help her print it out SQL debug output to page SQL
Here we use plugins or a way to start the config file wordpress debug
Create a new file in the Plugins folder wordpress/wp-content/plugins/called bt_debug_sql.php
<?php/*plugin Name: &NBSP;BT Debug sql.plugin URI: http://www.btroot.comDescription: &NBSP ; Show the SQL at the FrontPage. Author: rainysiaversion: 1.0author URI: HTTP://WWW.BT root.org *//** * Show Debug sql. * * @return void */add_action (' init ', ' bt_debug_sql '); function Bt_debug_sql () { if (!defined (' savequeries ')) { define (' Savequeries ', tr UE); } if (has_action (' Wp_footer ')) { add_action (' Wp_footer ', ' snx_s How_sql '); }}//show SqlFunction snx_show_sql () { if (isset ($_get[' Debug ') && $_get[' Debug '] = = true) { Global $wpdb; //echo ' <pre> '; & nbsp //print_r ($wpdb->queries); $all _debug_queries = $wpdb->queries; & nbsp Echo <table>; if (Isset ($all _debug_queries) && count ($all _DEBUG _queries) > 0) { $total _time_cost = 0; &NBSP ; $large _time_cost = 0; $large _sql_query = '; &N Bsp $large _sql_num = 0; $debug _file = false; if (Isset ($_get[' debug_file ')) && $_get[' debug_file '] = = true) { $debug _file = true; } Echo ' <t R style= "Font-weight:bold;" ><td>Num</td><td>Times</td><td>SQL</td> '; Echo $debug _file? ' <td>include files</td><tr> ': '; FOreach ($all _debug_queries as $k + $v) { //$v [0] is SQL, $v [1] is time, $v [2] is relative file. $total _time_cost + = $v [1]; if ($large _time_cost <= $v [1]) { &NB Sp $large _time_cost = $v [1]; $large _sql_query = $v [0]; $large _sql_num = $k + 1;&N Bsp } if ($k + 1)% 2 = = 1) { echo ' <tr style= ' Background-color: #8F9196 ; Color:rgb (202, 227, 253); " ><TD style= "Font-weight:bold;text-align:center;" > '. ($k + 1). ' </td> '; } else { Echo ' <tr> ; <td style= "font-weight:bold;text-align:center;" > '. ($k + 1). ' </td> '; } &NB Sp Echo ' <td style= ' text-align:left; > '. sprintf ("%.10f", $v [1]). ' </td> '; echo ' <td style= ' padding-left:6px;text-align: Left; " > '. $v [0]. ' </td> '; echo $debug _file? ' <td style= ' text-align:left; > '. $v [2]. ' </td> ': '; echo ' </tr> '; & nbsp } } echo ' <div style= text-align:left; > '; echo ' <div style= ' widht:100%;height:3px;margin:10px 0;background:rgba (56, 83, 129, 0.85)!important; -moz-box-shadow:0px 0px 1px #c3c3c3; -webkit-box-shadow:0px 0px 1px #c3c3c3; -box-shadow:0px 0px 1px #c3c3c3; " ></div> '; echo ' <div>the whole SQL queries Cost:<span style= "color:red;" > '. $total _time_cost ' s</span></div> '; echo ' The large SQL is No.<span style = "color:red;" > '. $large _sql_num ' </span> cost: <span style= "color:red;" > '. $large _time_cost. ' s</span><br/> <span style= ' Color:rgb (194, (+); Background-color: RGB (208, 210, 218); " > '. $large _sql_query. ' </span><br/> '; echo ' <div style= ' widht:90%;height:3px;margin:10px 0px; Background:rgba (143, 158, 0.85)!important; -moz-box-shadow:0px 0px 1px #c3c3c3; -webkit-box-shadow:0px 0px 1px #c3c3c3; -box-shadow:0px 0px 1px #c3c3c3; " ></div> '; echo ' </table> '; echo ' </div> '; }}
The function here is only to make WordPress savequeries static variable set to True, so you can also not, directly in the wp-config.php configuration file in the face add a sentence
Define (' Savequeries ', true);
The effect is the same.
Then/wp-content/theme/your theme/footer.php the last </div> before adding the following code to call once Wp_footer (); Save it.
<?php wp_footer ();?
>
You can save it. Then go to enable the plugin, when used, at the current page of the URL followed?
Debug=true can turn on debug SQL mode, plus debug_file=true displays the associated files for the include.
Http://test.com/solutions/vwideformat/test/?debug=1 and
Http://test.com/solutions/vwideformat/test/?debug=1&debug_file=1
The effects, such as the following
[Change yourself wordpress.2] to wordpress plus simple debug SQL debugging.