In `get_bookmarks()`, don't cache if 'orderby=rand'.
Props lukecavanagh, prettyboymp, c3mdigital, MikeHansenMe. Fixes #18356. Built from https://develop.svn.wordpress.org/trunk@37565 git-svn-id: http://core.svn.wordpress.org/trunk@37533 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
e7e20e4b54
commit
20301c4f6f
|
@ -128,7 +128,8 @@ function get_bookmarks( $args = '' ) {
|
||||||
$r = wp_parse_args( $args, $defaults );
|
$r = wp_parse_args( $args, $defaults );
|
||||||
|
|
||||||
$key = md5( serialize( $r ) );
|
$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 ] ) ) {
|
if ( is_array( $cache ) && isset( $cache[ $key ] ) ) {
|
||||||
$bookmarks = $cache[ $key ];
|
$bookmarks = $cache[ $key ];
|
||||||
/**
|
/**
|
||||||
|
@ -285,8 +286,10 @@ function get_bookmarks( $args = '' ) {
|
||||||
|
|
||||||
$results = $wpdb->get_results( $query );
|
$results = $wpdb->get_results( $query );
|
||||||
|
|
||||||
$cache[ $key ] = $results;
|
if ( 'rand()' !== $orderby ) {
|
||||||
wp_cache_set( 'get_bookmarks', $cache, 'bookmark' );
|
$cache[ $key ] = $results;
|
||||||
|
wp_cache_set( 'get_bookmarks', $cache, 'bookmark' );
|
||||||
|
}
|
||||||
|
|
||||||
/** This filter is documented in wp-includes/bookmark.php */
|
/** This filter is documented in wp-includes/bookmark.php */
|
||||||
return apply_filters( 'get_bookmarks', $results, $r );
|
return apply_filters( 'get_bookmarks', $results, $r );
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '4.6-alpha-37564';
|
$wp_version = '4.6-alpha-37565';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue