WordPress.org

Make WordPress Core

Ticket #17176: 17176.diff

File 17176.diff, 650 bytes (added by duck_, 3 years ago)
  • wp-includes/rewrite.php

     
    767767                global $wpdb; 
    768768 
    769769                //get pages in order of hierarchy, i.e. children after parents 
    770                 $posts = get_page_hierarchy($wpdb->get_results("SELECT ID, post_name, post_parent FROM $wpdb->posts WHERE post_type = 'page'")); 
     770                $posts = get_page_hierarchy( $wpdb->get_results("SELECT ID, post_name, post_parent FROM $wpdb->posts WHERE post_type = 'page' AND post_status != 'auto-draft'") ); 
    771771 
    772772                // If we have no pages get out quick 
    773773                if ( !$posts )