[wp-trac] [WordPress Trac] #36429: Twenty Eleven Ephemera widget fails to prevent caching in Customizer preview

WordPress Trac noreply at wordpress.org
Wed Apr 6 17:01:52 UTC 2016


#36429: Twenty Eleven Ephemera widget fails to prevent caching in Customizer
preview
---------------------------+----------------------------
 Reporter:  westonruter    |      Owner:
     Type:  defect (bug)   |     Status:  new
 Priority:  normal         |  Milestone:  Future Release
Component:  Bundled Theme  |    Version:  3.2
 Severity:  normal         |   Keywords:
  Focuses:                 |
---------------------------+----------------------------
 Changes to Twenty Eleven's Ephemera widget are currently getting cached
 when being changes in the Customizer Preview. This is specifically a
 problem when an external persistent object cache is used, since the cache
 gets dumped with each request otherwise.

 A change somewhat like this is needed:

 {{{#!diff
 --- src/wp-content/themes/twentyeleven/inc/widgets.php
 +++ src/wp-content/themes/twentyeleven/inc/widgets.php
 @@ -56,7 +56,7 @@ class Twenty_Eleven_Ephemera_Widget extends WP_Widget {
                 if ( ! isset( $args['widget_id'] ) )
                         $args['widget_id'] = null;

 -               if ( isset( $cache[ $args['widget_id'] ] ) ) {
 +               if ( ! is_customize_preview() && isset( $cache[
 $args['widget_id'] ] ) ) {
                         echo $cache[ $args['widget_id'] ];
                         return;
                 }
 @@ -132,7 +132,9 @@ class Twenty_Eleven_Ephemera_Widget extends WP_Widget
 {
                 endif;

                 $cache[ $args['widget_id'] ] = ob_get_flush();
 -               wp_cache_set( 'widget_twentyeleven_ephemera', $cache,
 'widget' );
 +               if ( ! is_customize_preview() ) {
 +                       wp_cache_set( 'widget_twentyeleven_ephemera',
 $cache, 'widget' );
 +               }
         }

         /**
 }}}

--
Ticket URL: <https://core.trac.wordpress.org/ticket/36429>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list