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: https://develop.svn.wordpress.org/trunk@12520 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
f79d69c71b
commit
71847c3df1
|
@ -786,15 +786,17 @@ class WP_Rewrite {
|
||||||
|
|
||||||
//get pages in order of hierarchy, i.e. children after parents
|
//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'"));
|
$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
|
//now reverse it, because we need parents after children for rewrite rules to work properly
|
||||||
$posts = array_reverse($posts, true);
|
$posts = array_reverse($posts, true);
|
||||||
|
|
||||||
$page_uris = array();
|
$page_uris = array();
|
||||||
$page_attachment_uris = array();
|
$page_attachment_uris = array();
|
||||||
|
|
||||||
if ( !$posts )
|
|
||||||
return array( array(), array() );
|
|
||||||
|
|
||||||
foreach ($posts as $id => $post) {
|
foreach ($posts as $id => $post) {
|
||||||
// URL => page name
|
// URL => page name
|
||||||
$uri = get_page_uri($id);
|
$uri = get_page_uri($id);
|
||||||
|
|
Loading…
Reference in New Issue