diff --git src/wp-includes/widgets/class-wp-widget-categories.php src/wp-includes/widgets/class-wp-widget-categories.php
index 13be3425e1..5a48c3fe95 100644
|
|
class WP_Widget_Categories extends WP_Widget { |
86 | 86 | * @param array $cat_args An array of Categories widget drop-down arguments. |
87 | 87 | * @param array $instance Array of settings for the current widget. |
88 | 88 | */ |
89 | | wp_dropdown_categories( apply_filters( 'widget_categories_dropdown_args', $cat_args, $instance ) ); |
90 | | |
| 89 | $cat_args = apply_filters( 'widget_categories_dropdown_args', $cat_args, $instance ); |
| 90 | $cat_args['echo'] = false; |
| 91 | |
| 92 | $dropdown = wp_dropdown_categories( $cat_args ); |
| 93 | $dropdown = preg_replace( |
| 94 | '/(?<=<select\b)/', |
| 95 | ' onchange="if ( this.value > 0 ) { this.form.submit(); }" ', |
| 96 | $dropdown, |
| 97 | 1 |
| 98 | ); |
| 99 | echo $dropdown; |
91 | 100 | echo '</form>'; |
92 | | ?> |
93 | | |
94 | | <script type='text/javascript'> |
95 | | /* <![CDATA[ */ |
96 | | (function() { |
97 | | var dropdown = document.getElementById( "<?php echo esc_js( $dropdown_id ); ?>" ); |
98 | | function onCatChange() { |
99 | | if ( dropdown.options[ dropdown.selectedIndex ].value > 0 ) { |
100 | | dropdown.parentNode.submit(); |
101 | | } |
102 | | } |
103 | | dropdown.onchange = onCatChange; |
104 | | })(); |
105 | | /* ]]> */ |
106 | | </script> |
107 | | |
108 | | <?php |
109 | 101 | } else { |
110 | 102 | ?> |
111 | 103 | <ul> |