Shoora
11/26/2018 - 1:39 AM

Show me dev info in WordPress

Show me dev info in WordPress

add_action( 'wp_footer', 'wds_debug' );
/*
 * Show me some dev info during development! DELETE ME BEFORE GOING LIVE!!!
 *
 */
function wds_debug() {
	global $template; ?><br />
	<?php echo $template; ?><br />
	<?php echo get_num_queries(); ?> queries in <?php timer_stop(1); ?> seconds<br />
	Server load: <?php $load = sys_getloadavg(); echo $load[0]; ?>%<br />
	Memory usage:
	<?php $mem_usage = memory_get_usage(true);
        if ($mem_usage < 1024)
            echo $mem_usage." bytes";
        elseif ($mem_usage < 1048576)
            echo round($mem_usage/1024,2)." kilobytes";
        else
            echo round($mem_usage/1048576,2)." megabytes";
    ?><br />
    PHP v<?php echo phpversion(); ?><br />
    Server date: <?php echo date('Y/j/m'); ?><br />
    Server time: <?php echo date('h:i:s a'); ?>
<?php }