Skip to content

Commit

Permalink
Always return a variable reference from get_pages(). props wonderboym…
Browse files Browse the repository at this point in the history
…usic, foxinni. fixes #20756.

git-svn-id: http://core.svn.wordpress.org/trunk@21550 1a063a9b-81f0-0310-95a4-ce76da25c4cd
  • Loading branch information
nacin committed Aug 20, 2012
1 parent 39ab1e4 commit 7a4fdb7
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions wp-includes/post.php
Expand Up @@ -3390,6 +3390,8 @@ function get_page_uri($page) {
function &get_pages($args = '') { function &get_pages($args = '') {
global $wpdb; global $wpdb;


$pages = false;

$defaults = array( $defaults = array(
'child_of' => 0, 'sort_order' => 'ASC', 'child_of' => 0, 'sort_order' => 'ASC',
'sort_column' => 'post_title', 'hierarchical' => 1, 'sort_column' => 'post_title', 'hierarchical' => 1,
Expand All @@ -3408,13 +3410,13 @@ function &get_pages($args = '') {
// Make sure the post type is hierarchical // Make sure the post type is hierarchical
$hierarchical_post_types = get_post_types( array( 'hierarchical' => true ) ); $hierarchical_post_types = get_post_types( array( 'hierarchical' => true ) );
if ( !in_array( $post_type, $hierarchical_post_types ) ) if ( !in_array( $post_type, $hierarchical_post_types ) )
return false; return $pages;


// Make sure we have a valid post status // Make sure we have a valid post status
if ( !is_array( $post_status ) ) if ( !is_array( $post_status ) )
$post_status = explode( ',', $post_status ); $post_status = explode( ',', $post_status );
if ( array_diff( $post_status, get_post_stati() ) ) if ( array_diff( $post_status, get_post_stati() ) )
return false; return $pages;


$cache = array(); $cache = array();
$key = md5( serialize( compact(array_keys($defaults)) ) ); $key = md5( serialize( compact(array_keys($defaults)) ) );
Expand Down

0 comments on commit 7a4fdb7

Please sign in to comment.