Ticket #8700: selected_none_all_dropdown_cats.diff

File selected_none_all_dropdown_cats.diff, 933 bytes (added by filosofo, 4 years ago)
Line 
1Index: wp-includes/category-template.php
2===================================================================
3--- wp-includes/category-template.php   (revision 10240)
4+++ wp-includes/category-template.php   (working copy)
5@@ -397,12 +397,14 @@
6 
7                if ( $show_option_all ) {
8                        $show_option_all = apply_filters( 'list_cats', $show_option_all );
9-                       $output .= "\t<option value='0'>$show_option_all</option>\n";
10+                       $selected = ( '0' === strval($r['selected']) ) ? " selected='selected'" : '';
11+                       $output .= "\t<option value='0'$selected>$show_option_all</option>\n";
12                }
13 
14                if ( $show_option_none ) {
15                        $show_option_none = apply_filters( 'list_cats', $show_option_none );
16-                       $output .= "\t<option value='-1'>$show_option_none</option>\n";
17+                       $selected = ( '-1' === strval($r['selected']) ) ? " selected='selected'" : '';
18+                       $output .= "\t<option value='-1'$selected>$show_option_none</option>\n";
19                }
20 
21                if ( $hierarchical )