From c21c9af12a4595c1f5149b71f348dd684c4600ff Mon Sep 17 00:00:00 2001 From: ryan Date: Wed, 13 Feb 2008 09:30:26 +0000 Subject: [PATCH] Reduce queries by wp_count_posts(). Props josephscott. fixes #5820 git-svn-id: http://svn.automattic.com/wordpress/trunk@6808 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/edit-pages.php | 6 +++--- wp-admin/edit.php | 4 ++-- wp-admin/index.php | 27 ++++++++++----------------- wp-includes/post.php | 16 +++++++++++----- 4 files changed, 26 insertions(+), 27 deletions(-) diff --git a/wp-admin/edit-pages.php b/wp-admin/edit-pages.php index db44ae967c..4ea84145ef 100644 --- a/wp-admin/edit-pages.php +++ b/wp-admin/edit-pages.php @@ -45,18 +45,18 @@ printf( _c( '%1$s%2$s%3$s|You can reorder these: 1: Pages, 2: by {s}, 3: matchin $avail_post_stati = get_available_post_statuses('page'); $status_links = array(); +$num_posts = wp_count_posts('page'); foreach ( $post_stati as $status => $label ) { $class = ''; if ( !in_array($status, $avail_post_stati) ) continue; - - $num_posts = wp_count_posts('page', $status); + if ( $status == $_GET['post_status'] ) $class = ' class="current"'; $status_links[] = "
  • " . - sprintf($label[2], $num_posts) . ''; + sprintf($label[2], $num_posts->$status) . ''; } $class = empty($_GET['post_status']) ? ' class="current"' : ''; $status_links[] = "
  • All Pages"; diff --git a/wp-admin/edit.php b/wp-admin/edit.php index ccf01f7b41..d0895fad8c 100644 --- a/wp-admin/edit.php +++ b/wp-admin/edit.php @@ -52,18 +52,18 @@ if ( is_single() ) {