WordPress.org

Make WordPress Core

Ticket #11433: 12397-update-wp_dropdown_pages.diff

File 12397-update-wp_dropdown_pages.diff, 1008 bytes (added by jeremyclarke, 8 years ago)

12397 - update wp_dropdown_pages with id argument

  • wp-includes/post-template.php

     
    690690        $defaults = array(
    691691                'depth' => 0, 'child_of' => 0,
    692692                'selected' => 0, 'echo' => 1,
    693                 'name' => 'page_id', 'show_option_none' => '', 'show_option_no_change' => '',
     693                'name' => 'page_id', 'id' => '',
     694                'show_option_none' => '', 'show_option_no_change' => '',
    694695                'option_none_value' => ''
    695696        );
    696697
     
    700701        $pages = get_pages($r);
    701702        $output = '';
    702703        $name = esc_attr($name);
     704        // Back-compat with old system where both id and name were based on $name argument
     705        if ( empty($id) )
     706                $id = $name;
    703707
    704708        if ( ! empty($pages) ) {
    705                 $output = "<select name=\"$name\" id=\"$name\">\n";
     709                $output = "<select name=\"$name\" id=\"$id\">\n";
    706710                if ( $show_option_no_change )
    707711                        $output .= "\t<option value=\"-1\">$show_option_no_change</option>";
    708712                if ( $show_option_none )