Make WordPress Core

Changeset 18677


Ignore:
Timestamp:
09/15/2011 10:08:43 AM (14 years ago)
Author:
westi
Message:

Set a consistent cache key when using the_widget to display the Recent Posts and Recent Comments widgets so that they get cached. See #16761.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/default-widgets.php

    r18676 r18677  
    526526            $cache = array();
    527527
    528         if ( isset( $args['widget_id'] ) && isset( $cache[ $args['widget_id'] ] ) ) {
     528            if ( ! isset( $args['widget_id'] ) )
     529            $args['widget_id'] = $this->id;
     530
     531        if ( false && isset( $cache[ $args['widget_id'] ] ) ) {
    529532            echo $cache[ $args['widget_id'] ];
    530533            return;
     
    629632            $cache = array();
    630633
    631         if ( isset( $args['widget_id'] ) && isset( $cache[ $args['widget_id'] ] ) ) {
     634        if ( ! isset( $args['widget_id'] ) )
     635            $args['widget_id'] = $this->id;
     636
     637        if ( false && isset( $cache[ $args['widget_id'] ] ) ) {
    632638            echo $cache[ $args['widget_id'] ];
    633639            return;
Note: See TracChangeset for help on using the changeset viewer.