From 7a45d0e309ab3f4f89186edcdb711343f3094d5c Mon Sep 17 00:00:00 2001 From: michelvaldrighi Date: Thu, 17 Feb 2005 00:11:35 +0000 Subject: [PATCH] whoops, make wp_list_pages not spew a warning when there are no pages git-svn-id: https://develop.svn.wordpress.org/trunk@2360 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/template-functions-post.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/wp-includes/template-functions-post.php b/wp-includes/template-functions-post.php index b4978f38b1..f735430040 100644 --- a/wp-includes/template-functions-post.php +++ b/wp-includes/template-functions-post.php @@ -297,10 +297,12 @@ function get_pages($args = '') { "$exclusions " . "ORDER BY " . $r['sort_column'] . " " . $r['sort_order']); - foreach($pages as $page) { - $cache_pages[$page->ID] = $page; + $cache_pages = array(); + if (count($pages)) { + foreach($pages as $page) { + $cache_pages[$page->ID] = $page; + } } - } return $cache_pages;