mirror of
https://github.com/WordPress/WordPress.git
synced 2025-02-02 05:31:25 +01:00
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:
parent
b9dfd1fb4a
commit
05e19b1cde
@ -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
Block a user