29
Mar
2009



Bookmark and Share

wordpressIf you are running a WordPress blog, you might want to keep a keen eye on its plugins to know how many queries and the time required to process them they are producing on your web pages.  This is particular useful if you are trying to optimize your database in order to save the resources your server has assigned to your blog.  Here is a simple code to add to your blog’s pages.

Just add this code wherever you want within your blog’s theme (usually it is added to single.php and page.php files):

<?php echo $wpdb->num_queries; ?> <?php _e(‘queries’); ?>. <?php timer_stop(1); ?> <?php _e(‘seconds’); ?>

If you want to know a little more about this code, I have dissected it below, describing what the single pieces do:

  1. <?php echo $wpdb->num_queries; ?> = display the number of queries the page has got.
  2. <?php timer_stop(1); ?> = returns the time to process the page.

Tags: , ,


Related ArticlesLatest Articles
.

Leave a Comment

If you want to show an image next to your comments, get your gravatar now!

This blog is moderated. Inappropriate comments will be edited or removed. Users posting offensive comments will be banned from this blog. Report Inappropriate Comments Here.

XHTML - You can use the following tags:  <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>




Copyright © 2007-2012 | Sitemap | Privacy | Back To Top
Best screen resolution 1280x800 or higher.
Web Talk is best viewed in Firefox.

Stat