WordPress.org

Make WordPress Core

Ticket #23026: parent_dropdown_fix.patch

File parent_dropdown_fix.patch, 597 bytes (added by mweichert, 2 years ago)

Patch for template.php

  • wp-admin/includes/template.php

     
    677677        $post = get_post(); 
    678678        $items = $wpdb->get_results( $wpdb->prepare("SELECT ID, post_parent, post_title FROM $wpdb->posts WHERE post_parent = %d AND post_type = 'page' ORDER BY menu_order", $parent) ); 
    679679 
    680         if ( $items ) { 
     680        if ( $post && $items ) { 
    681681                foreach ( $items as $item ) { 
    682682                        // A page cannot be its own parent. 
    683683                        if ( $post->ID && $item->ID == $post->ID )