Make WordPress Core

Ticket #18356: 18356.5.diff

File 18356.5.diff, 944 bytes (added by lukecavanagh, 8 years ago)

Skip cache by order if random

  • src/wp-includes/bookmark.php

     
    128128        $r = wp_parse_args( $args, $defaults );
    129129
    130130        $key = md5( serialize( $r ) );
    131         if ( $cache = wp_cache_get( 'get_bookmarks', 'bookmark' ) ) {
     131        if ( $cache = wp_cache_get( 'get_bookmarks', 'bookmark' ) && 'rand' !== $orderby ) {
    132132                if ( is_array( $cache ) && isset( $cache[ $key ] ) ) {
    133133                        $bookmarks = $cache[ $key ];
    134134                        /**
     
    285285
    286286        $results = $wpdb->get_results( $query );
    287287
    288         $cache[ $key ] = $results;
    289         wp_cache_set( 'get_bookmarks', $cache, 'bookmark' );
     288        if ( 'rand' !== $orderby ) {
     289                $cache[ $key ] = $results;
     290                wp_cache_set( 'get_bookmarks', $cache, 'bookmark' );
     291        }
    290292
    291293        /** This filter is documented in wp-includes/bookmark.php */
    292294        return apply_filters( 'get_bookmarks', $results, $r );