Check that get_page_hierarchy() returns something before trying to build the verbose page rules in WP_Rewrite::page_uri_index(). Fixes #11578.

git-svn-id: http://svn.automattic.com/wordpress/trunk@12520 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
westi 2009-12-23 16:23:40 +00:00
parent b9dfd1fb4a
commit 05e19b1cde
1 changed files with 5 additions and 3 deletions

View File

@ -786,15 +786,17 @@ class WP_Rewrite {
//get pages in order of hierarchy, i.e. children after parents
$posts = get_page_hierarchy($wpdb->get_results("SELECT ID, post_name, post_parent FROM $wpdb->posts WHERE post_type = 'page'"));
// If we have no pages get out quick
if ( !$posts )
return array( array(), array() );
//now reverse it, because we need parents after children for rewrite rules to work properly
$posts = array_reverse($posts, true);
$page_uris = array();
$page_attachment_uris = array();
if ( !$posts )
return array( array(), array() );
foreach ($posts as $id => $post) {
// URL => page name
$uri = get_page_uri($id);