mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-12 04:40:26 +00:00
In get_bookmarks(), don't cache if 'orderby=rand'.
Props lukecavanagh, prettyboymp, c3mdigital, MikeHansenMe. Fixes #18356. git-svn-id: https://develop.svn.wordpress.org/trunk@37565 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -128,7 +128,8 @@ function get_bookmarks( $args = '' ) {
|
||||
$r = wp_parse_args( $args, $defaults );
|
||||
|
||||
$key = md5( serialize( $r ) );
|
||||
if ( $cache = wp_cache_get( 'get_bookmarks', 'bookmark' ) ) {
|
||||
$cache = false;
|
||||
if ( 'rand' !== $r['orderby'] && $cache = wp_cache_get( 'get_bookmarks', 'bookmark' ) ) {
|
||||
if ( is_array( $cache ) && isset( $cache[ $key ] ) ) {
|
||||
$bookmarks = $cache[ $key ];
|
||||
/**
|
||||
@@ -285,8 +286,10 @@ function get_bookmarks( $args = '' ) {
|
||||
|
||||
$results = $wpdb->get_results( $query );
|
||||
|
||||
$cache[ $key ] = $results;
|
||||
wp_cache_set( 'get_bookmarks', $cache, 'bookmark' );
|
||||
if ( 'rand()' !== $orderby ) {
|
||||
$cache[ $key ] = $results;
|
||||
wp_cache_set( 'get_bookmarks', $cache, 'bookmark' );
|
||||
}
|
||||
|
||||
/** This filter is documented in wp-includes/bookmark.php */
|
||||
return apply_filters( 'get_bookmarks', $results, $r );
|
||||
|
||||
Reference in New Issue
Block a user