Make WordPress Core


Ignore:
Timestamp:
05/25/2016 06:29:01 PM (8 years ago)
Author:
boonebgorges
Message:

In get_bookmarks(), don't cache if 'orderby=rand'.

Props lukecavanagh, prettyboymp, c3mdigital, MikeHansenMe.
Fixes #18356.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/bookmark.php

    r37542 r37565  
    129129
    130130    $key = md5( serialize( $r ) );
    131     if ( $cache = wp_cache_get( 'get_bookmarks', 'bookmark' ) ) {
     131    $cache = false;
     132    if ( 'rand' !== $r['orderby'] && $cache = wp_cache_get( 'get_bookmarks', 'bookmark' ) ) {
    132133        if ( is_array( $cache ) && isset( $cache[ $key ] ) ) {
    133134            $bookmarks = $cache[ $key ];
     
    286287    $results = $wpdb->get_results( $query );
    287288
    288     $cache[ $key ] = $results;
    289     wp_cache_set( 'get_bookmarks', $cache, 'bookmark' );
     289    if ( 'rand()' !== $orderby ) {
     290        $cache[ $key ] = $results;
     291        wp_cache_set( 'get_bookmarks', $cache, 'bookmark' );
     292    }
    290293
    291294    /** This filter is documented in wp-includes/bookmark.php */
Note: See TracChangeset for help on using the changeset viewer.