WordPress.org

Make WordPress Core

Ticket #17026: 17026.2.diff

File 17026.2.diff, 996 bytes (added by boonebgorges, 5 years ago)
  • src/wp-admin/includes/template.php

    diff --git src/wp-admin/includes/template.php src/wp-admin/includes/template.php
    index 5304cf8..d918a55 100644
    function page_template_dropdown( $default = '' ) { 
    808808 * @return void|bool Boolean False if page has no children, otherwise print out html elements
    809809 */
    810810function parent_dropdown( $default = 0, $parent = 0, $level = 0 ) {
    811         global $wpdb;
    812811        $post = get_post();
    813         $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) );
     812
     813        $items = get_posts( apply_filters( 'parent_dropdown_args', array(
     814                'post_parent' => $parent,
     815                'post_type' => 'page',
     816                'orderby' => 'menu_order',
     817                'posts_per_page' => -1,
     818                'update_post_meta_cache' => false,
     819                'update_post_term_cache' => false,
     820                'no_found_rows' => true,
     821        ) ) );
    814822
    815823        if ( $items ) {
    816824                foreach ( $items as $item ) {