WordPress.org

Make WordPress Core

Ticket #8700: selected_none_all_dropdown_cats.diff

File selected_none_all_dropdown_cats.diff, 933 bytes (added by filosofo, 6 years ago)
  • wp-includes/category-template.php

     
    397397 
    398398                if ( $show_option_all ) { 
    399399                        $show_option_all = apply_filters( 'list_cats', $show_option_all ); 
    400                         $output .= "\t<option value='0'>$show_option_all</option>\n"; 
     400                        $selected = ( '0' === strval($r['selected']) ) ? " selected='selected'" : ''; 
     401                        $output .= "\t<option value='0'$selected>$show_option_all</option>\n"; 
    401402                } 
    402403 
    403404                if ( $show_option_none ) { 
    404405                        $show_option_none = apply_filters( 'list_cats', $show_option_none ); 
    405                         $output .= "\t<option value='-1'>$show_option_none</option>\n"; 
     406                        $selected = ( '-1' === strval($r['selected']) ) ? " selected='selected'" : ''; 
     407                        $output .= "\t<option value='-1'$selected>$show_option_none</option>\n"; 
    406408                } 
    407409 
    408410                if ( $hierarchical )