`WP_Comment_Query`: Fill comment objects from database when cache is unavailable.

This fixes a bug where widgets loaded in a preview or the Customizer are
rendered inside of a `wp_suspend_cache_addition()` block and thus could not
find comment objects in the cache.

Props rommelxcastro, stevehenty.
Fixes #34138.
Built from https://develop.svn.wordpress.org/trunk@35512


git-svn-id: http://core.svn.wordpress.org/trunk@35476 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Boone Gorges 2015-11-04 21:09:27 +00:00
parent 1ddb8b94af
commit 5c1ca9d943
2 changed files with 2 additions and 2 deletions

View File

@ -412,7 +412,7 @@ class WP_Comment_Query {
// Fetch full comment objects from the primed cache. // Fetch full comment objects from the primed cache.
$_comments = array(); $_comments = array();
foreach ( $comment_ids as $comment_id ) { foreach ( $comment_ids as $comment_id ) {
if ( $_comment = wp_cache_get( $comment_id, 'comment' ) ) { if ( $_comment = get_comment( $comment_id ) ) {
$_comments[] = $_comment; $_comments[] = $_comment;
} }
} }

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.4-beta2-35511'; $wp_version = '4.4-beta2-35512';
/** /**
* 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.