From b7c70cad148a5a4c57b8403ed4ba5008f821a67a Mon Sep 17 00:00:00 2001 From: Weston Ruter Date: Wed, 20 Sep 2017 03:15:19 +0000 Subject: [PATCH] Widgets: Add Customizer preview support to the Category widget when navigating to a category via dropdown. Switch to using a `form` that is submitted as opposed to making a direct JavaScript call to change the `window.location`. This ensures the Customizer is able to inject the customized state into the request. Fixes #41671. git-svn-id: https://develop.svn.wordpress.org/trunk@41547 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/widgets/class-wp-widget-categories.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/wp-includes/widgets/class-wp-widget-categories.php b/src/wp-includes/widgets/class-wp-widget-categories.php index 21e375eddc..f208db9481 100644 --- a/src/wp-includes/widgets/class-wp-widget-categories.php +++ b/src/wp-includes/widgets/class-wp-widget-categories.php @@ -59,10 +59,11 @@ class WP_Widget_Categories extends WP_Widget { $cat_args = array( 'orderby' => 'name', 'show_count' => $c, - 'hierarchical' => $h + 'hierarchical' => $h, ); if ( $d ) { + echo sprintf( '
', esc_url( home_url() ) ); $dropdown_id = ( $first_dropdown ) ? 'cat' : "{$this->id_base}-dropdown-{$this->number}"; $first_dropdown = false; @@ -81,6 +82,8 @@ class WP_Widget_Categories extends WP_Widget { * @param array $cat_args An array of Categories widget drop-down arguments. */ wp_dropdown_categories( apply_filters( 'widget_categories_dropdown_args', $cat_args ) ); + + echo '
'; ?>