Make WordPress Core


Ignore:
Timestamp:
12/23/2009 04:23:40 PM (14 years ago)
Author:
westi
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/rewrite.php

    r12271 r12520  
    787787        //get pages in order of hierarchy, i.e. children after parents
    788788        $posts = get_page_hierarchy($wpdb->get_results("SELECT ID, post_name, post_parent FROM $wpdb->posts WHERE post_type = 'page'"));
     789       
     790        // If we have no pages get out quick
     791        if ( !$posts )
     792            return array( array(), array() );
     793
    789794        //now reverse it, because we need parents after children for rewrite rules to work properly
    790795        $posts = array_reverse($posts, true);
     
    792797        $page_uris = array();
    793798        $page_attachment_uris = array();
    794 
    795         if ( !$posts )
    796             return array( array(), array() );
    797799
    798800        foreach ($posts as $id => $post) {
Note: See TracChangeset for help on using the changeset viewer.