From beec541ae90732a17953cb6bc81608d36faed7b7 Mon Sep 17 00:00:00 2001 From: Andrew Nacin Date: Mon, 20 Aug 2012 16:38:43 +0000 Subject: [PATCH] Always return a variable reference from get_pages(). props wonderboymusic, foxinni. fixes #20756. git-svn-id: https://develop.svn.wordpress.org/trunk@21550 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/post.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/wp-includes/post.php b/wp-includes/post.php index b22abf6a82..3922a478b6 100644 --- a/wp-includes/post.php +++ b/wp-includes/post.php @@ -3390,6 +3390,8 @@ function get_page_uri($page) { function &get_pages($args = '') { global $wpdb; + $pages = false; + $defaults = array( 'child_of' => 0, 'sort_order' => 'ASC', 'sort_column' => 'post_title', 'hierarchical' => 1, @@ -3408,13 +3410,13 @@ function &get_pages($args = '') { // Make sure the post type is hierarchical $hierarchical_post_types = get_post_types( array( 'hierarchical' => true ) ); if ( !in_array( $post_type, $hierarchical_post_types ) ) - return false; + return $pages; // Make sure we have a valid post status if ( !is_array( $post_status ) ) $post_status = explode( ',', $post_status ); if ( array_diff( $post_status, get_post_stati() ) ) - return false; + return $pages; $cache = array(); $key = md5( serialize( compact(array_keys($defaults)) ) );